⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 teesurfa.pas

📁 BCB第三方组件
💻 PAS
📖 第 1 页 / 共 5 页
字号:

  TOnGetLevelEvent=procedure( Sender:TContourSeries; LevelIndex:Integer;
                            Var Value:Double; Var Color:TColor) of object;

  {$IFDEF LEVELSEGMENTS}
  TLevelPoint=packed record
     X,Y: TChartValue;
  end;

  TLevelSegment=packed record
    Count  : Integer;
    Points : packed Array of TLevelPoint;
  end;

  TLevelSegments=Array of TLevelSegment;
  {$ENDIF}

  TContourLevel=class(TCollectionItem)
  private
    FColor  : TColor;
    FPen    : TChartPen;
    FUpTo   : Double;

    ISeries : TContourSeries;

    {$IFDEF LEVELSEGMENTS}
    FSegmentCount : Integer;
    FSegments     : TLevelSegments;
    {$ENDIF}

    Procedure CheckAuto;
    function GetPen: TChartPen;
    function IsPenStored: Boolean;
    procedure SetColor(const Value: TColor);
    procedure SetPen(const Value: TChartPen);
    procedure SetUpTo(const Value: Double);
  protected
    function InternalColor:TColor;
    function InternalPen:TChartPen;
  public
    Constructor Create(Collection:TCollection); override;
    Destructor Destroy; override;

    Procedure Assign(Source:TPersistent); override; { 5.01 }

    {$IFDEF LEVELSEGMENTS}
    Procedure ClearSegments;
    Function Clicked(x,y:Integer; Var SegmentIndex,PointIndex:Integer):Boolean;
    Function ClickedSegment(x,y,SegmentIndex:Integer; Var PointIndex:Integer):Boolean;
    Function GetSegmentPoints(SegmentIndex:Integer):TPointArray;
    {$ENDIF}

    Function DefaultPen:Boolean;

    {$IFDEF LEVELSEGMENTS}
    function SegmentCount:Integer; {$IFDEF 10}inline;{$ENDIF}
    property Segments:TLevelSegments read FSegments;
    {$ENDIF}
  published
    property Color:TColor read FColor write SetColor;
    property Pen:TChartPen read GetPen write SetPen stored IsPenStored; // 5.03
    property UpToValue:Double read FUpTo write SetUpTo;
  end;

  TContourLevels=class(TOwnedCollection)
  private
    Function Get(Index:Integer):TContourLevel;
    Procedure Put(Index:Integer; Const Value:TContourLevel);
  public
    function AddLevel(const Value:Double; Color:TColor):TContourLevel;

    {$IFDEF LEVELSEGMENTS}
    Function Clicked(x,y:Integer; Var SegmentIndex,PointIndex:Integer):Integer;
    {$ENDIF}
    property Items[Index:Integer]:TContourLevel read Get write Put; default;
  end;

  TSmoothPoints=class(TPersistent)
  private
    FActive : Boolean;
    ISeries : TChartSeries;
    FInterpolate: Boolean;
    procedure SetActive(const Value: Boolean);
    procedure SetInterpolate(const Value: Boolean);
  public
    Factor : Integer;
    Constructor Create(Parent:TChartSeries);
    Procedure Assign(Source:TPersistent); override;
    Function Calculate(Const P:Array of TPoint):TPointArray;
  published
    property Active:Boolean read FActive write SetActive default False;
    property Interpolate:Boolean read FInterpolate write SetInterpolate default False;
  end;

  TContourMarks=class(TPersistent)
  private
    FAntiOverlap : Boolean;
    FAtSegments  : Boolean;
    FColorLevel  : Boolean;
    FDensity     : Integer;
    FMargin      : Integer;

    IContour : TChartSeries;
    function GetVisible: Boolean;
    procedure SetAntiOverlap(const Value: Boolean);
    procedure SetAtSegments(const Value: Boolean);
    procedure SetColorLevel(const Value: Boolean);
    procedure SetDensity(const Value: Integer);
    procedure SetMargin(const Value: Integer);
    procedure SetVisible(const Value: Boolean);
  public
    Constructor Create;
    procedure Assign(Source:TPersistent); override;
  published
    property AntiOverlap:Boolean read FAntiOverlap write SetAntiOverlap default False;
    property AtSegments:Boolean read FAtSegments write SetAtSegments default True;
    property ColorLevel:Boolean read FColorLevel write SetColorLevel default False;
    property Margin:Integer read FMargin write SetMargin default 0;
    property Density:Integer read FDensity write SetDensity default 4;
    property Visible:Boolean read GetVisible write SetVisible stored False;
  end;

  TContourSeries=class(TCustom3DGridSeries)
  private
    FAutomaticLevels: Boolean;
    FContourMarks   : TContourMarks;
    FLegendLines    : Boolean;
    FLevels         : TContourLevels;
    FLinesColor     : TColor;
    FNumLevels      : Integer;
    FPointer        : TSeriesPointer;
    FSmoothing      : TSmoothPoints;
    FTransparency   : TTeeTransparency;
    FYPosition      : Double;
    FYPositionLevel : Boolean;

    FOnBeforeDrawLevel : TOnBeforeDrawLevelEvent;
    FOnGetLevel        : TOnGetLevelEvent;

    IModifyingLevels : Boolean;
    FFrame: TChartHiddenPen;

    procedure ClearAutoLevels;
    function GetNumLevels: Integer;
    function IsLevelsStored: Boolean;
    function LegendLevel(Index:Integer):TContourLevel;
    procedure SetAutomaticLevels(const Value: Boolean);
    procedure SetContourMarks(const Value: TContourMarks);
    procedure SetFrame(const Value: TChartHiddenPen);
    procedure SetLegendLines(const Value: Boolean);
    procedure SetLevels(const Value: TContourLevels);
    procedure SetLinesColor(const Value: TColor);
    Procedure SetNumLevels(Value:Integer);
    Procedure SetPointer(Const Value:TSeriesPointer);
    procedure SetSmoothing(const Value: TSmoothPoints);
    procedure SetTransparency(const Value: TTeeTransparency);
    Procedure SetYPosition(Const Value:Double);
    Procedure SetYPositionLevel(Value:Boolean);
    procedure TryCreateLevels;
  protected
    class Procedure CreateSubGallery(AddSubChart:TChartSubGalleryProc); override;
    procedure AddSampleValues(NumValues:Integer; OnlyMandatory:Boolean=False); override;
    Procedure DoBeforeDrawChart; override;
    procedure DrawAllValues; override;
    Procedure DrawLegendShape(ValueIndex:Integer; Const Rect:TRect); override;
    Procedure DrawMark(ValueIndex:Integer; Const St:String;
                       APosition:TSeriesMarkPosition); override;
    procedure DrawMarks; override;
    class Function GetEditorClass:String; override;
    Procedure NotifyValue(ValueEvent:TValueEvent; ValueIndex:Integer); override;
    Procedure PrepareForGallery(IsEnabled:Boolean); override;
    procedure SetParentChart(const Value: TCustomAxisPanel); override;
    class Procedure SetSubGallery(ASeries:TChartSeries; Index:Integer); override;
  public
    Constructor Create(AOwner: TComponent); override;
    Destructor Destroy; override;

    Procedure Assign(Source:TPersistent); override;
    {$IFDEF LEVELSEGMENTS}
    Function Clicked(x,y:Integer):Integer; override;
    {$ENDIF}
    Function CountLegendItems:Integer; override;
    Procedure CreateAutoLevels;
    function GetZAxis:TChartAxis;
    Function LegendItemColor(LegendIndex:Integer):TColor; override;
    Function LegendString( LegendIndex:Integer;
                           LegendTextStyle:TLegendTextStyle ):String; override;
    Function MaxYValue:Double; override;
    Function MinYValue:Double; override;
  published
    property Active;
    property AutomaticLevels:Boolean read FAutomaticLevels write SetAutomaticLevels default True;
    property ColorEachPoint default True;
    property ColorSource;
    property ContourMarks:TContourMarks read FContourMarks write SetContourMarks;
    property Cursor;
    property Frame:TChartHiddenPen read FFrame write SetFrame;
    property HorizAxis;
    property Marks;
    property ParentChart;
    property DataSource;
    property PercentFormat;
    property SeriesColor;
    property ShowInLegend;
    property Title;
    property ValueFormat;
    property VertAxis;
    property XLabelsSource;

    property EndColor;
    property IrregularGrid;
    property LegendEvery;

    // Draw simple lines at legend when levels aren't filled.
    property LegendLines:Boolean read FLegendLines write SetLegendLines default False;

    property Levels:TContourLevels read FLevels write SetLevels stored IsLevelsStored;

    // Default color to draw level lines when Brush.Style<>bsClear.
    // "clDefault" means color is same as level color. Default is clBlack.
    property LinesColor:TColor read FLinesColor write SetLinesColor default clBlack;

    property MidColor;
    property NumLevels:Integer read GetNumLevels write SetNumLevels default 10;
    property NumXValues;
    property NumZValues;
    property PaletteMin;
    property PaletteStep;
    property PaletteSteps;
    property PaletteStyle;
    property Pen;
    property Pointer:TSeriesPointer read FPointer write SetPointer;
    property Smoothing:TSmoothPoints read FSmoothing write SetSmoothing;
    property StartColor;
    property TimesZOrder;
    property Transparency:TTeeTransparency read FTransparency write SetTransparency default 0;
    property UseColorRange;
    property UsePalette;
    property UsePaletteMin;
    property XValues;
    property YPosition:Double read FYPosition write SetYPosition;
    property YPositionLevel:Boolean read FYPositionLevel write SetYPositionLevel default False;
    property YValues;
    property ZValues;

    { events }
    { events }
    property AfterDrawValues;
    property BeforeDrawValues;
    property OnAfterAdd;
    property OnBeforeAdd;
    property OnClearValues;
    property OnClick;
    property OnDblClick;
    property OnGetMarkText;
    property OnMouseEnter;
    property OnMouseLeave;

    property OnBeforeDrawLevel:TOnBeforeDrawLevelEvent read FOnBeforeDrawLevel
                                                       write FOnBeforeDrawLevel;
    property OnGetYValue;
    property OnGetLevel:TOnGetLevelEvent read FOnGetLevel write FOnGetLevel;
  end;

  TWaterFallSeries=class(TSurfaceSeries)
  protected
    class Procedure CreateSubGallery(AddSubChart:TChartSubGalleryProc); override;
    Procedure GalleryChanged3D(Is3D:Boolean); override;
    class Function GetEditorClass:String; override;
    class Procedure SetSubGallery(ASeries:TChartSeries; Index:Integer); override;
  public
    Constructor Create(AOwner: TComponent); override;
    Procedure Assign(Source:TPersistent); override;  // 7.01
  published
    property WaterFall default True;
    property WaterLines;
  end;

  TColorGridSeries=class(TCustom3DGridSeries)
  private
    FBitmap       : TBitmap;
    FCentered     : Boolean;
    FPlane3D      : TCanvas3DPlane;
    FFrame        : TChartHiddenPen;
    FPosition     : Integer;
    FSmoothBitmap : Boolean;
    FXGridEvery   : Integer;
    FZGridEvery   : Integer;
    FTransparency: TTeeTransparency;

    function CalcMaxValue(const Value:Double):Double;
    function CalcMinValue(const Value:Double):Double;
    procedure SetBitmap(const Value: TBitmap);
    procedure SetCentered(const Value: Boolean);
    procedure SetPlane3D(const Value: TCanvas3DPlane);
    procedure SetFrame(const Value: TChartHiddenPen);
    procedure SetPosition(const Value: Integer);
    procedure SetSmoothBitmap(const Value: Boolean);
    procedure SetTransparency(const Value: TTeeTransparency);
    procedure SetXGridEvery(const Value: Integer);
    procedure SetZGridEvery(const Value: Integer);
  protected
    class Procedure CreateSubGallery(AddSubChart:TChartSubGalleryProc); override;
    procedure DrawAllValues; override;
    Procedure DrawMark( ValueIndex:Integer; Const St:String;
                        APosition:TSeriesMarkPosition); override;
    Procedure GalleryChanged3D(Is3D:Boolean); override;
    class Function GetEditorClass:String; override;
    Procedure PrepareForGallery(IsEnabled:Boolean); override;
    class Procedure SetSubGallery(ASeries:TChartSeries; Index:Integer); override;
  public
    Constructor Create(AOwner:TComponent); override;
    Destructor Destroy; override;

    procedure Assign(Source:TPersistent); override;

    function CellBounds(ValueIndex:Integer):TRect; overload;
    function CellBounds(x,z:Integer):TRect; overload;
    
    Function Clicked(X,Y:Integer):Integer; override;
    Function MinXValue:Double; override;
    Function MaxXValue:Double; override;
    Function MaxYValue:Double; override;
    Function MinYValue:Double; override;
    Function MinZValue:Double; override;
    Function MaxZValue:Double; override;

    property Bitmap:TBitmap read FBitmap write SetBitmap;
  published
    { Published declarations }
    property Active;
    property CenteredPoints:Boolean read FCentered write SetCentered default False;
    property ColorSource;
    property Cursor;
    property DrawPlane3D:TCanvas3DPlane read FPlane3D write SetPlane3D default cpZ;
    property DrawPosition:Integer read FPosition write SetPosition default 0;
    property Frame:TChartHiddenPen read FFrame write SetFrame;
    property HorizAxis;
    property Marks;
    property ParentChart;
    property DataSource;
    property PercentFormat;
    property SeriesColor;
    property ShowInLegend;
    property SmoothBitmap:Boolean read FSmoothBitmap write SetSmoothBitmap default False;  // 7.0
    property Title;
    property Transparency:TTeeTransparency read FTransparency write SetTransparency default 0;
    property ValueFormat;
    property VertAxis;
    property XGridEvery:Integer read FXGridEvery write SetXGridEvery default 1; // 7.0
    property XLabelsSource;
    property ZGridEvery:Integer read FZGridEvery write SetZGridEvery default 1; // 7.0

    { events }
    property AfterDrawValues;
    property BeforeDrawValues;
    property OnAfterAdd;
    property OnBeforeAdd;
    property OnClearValues;
    property OnClick;
    property OnDblClick;
    property OnGetMarkText;
    property OnMouseEnter;
    property OnMouseLeave;

    property Brush;
    property EndColor;
    property IrregularGrid;
    property MidColor;
    property NumXValues;
    property NumZValues;
    property LegendEvery;
    property Pen;
    property PaletteMin;
    property PaletteStep;
    property PaletteSteps;
    property PaletteStyle;
    property StartColor;
    property UseColorRange;
    property UsePalette;
    property UsePaletteMin;
    property TimesZOrder;
    property XValues;
    property YValues;
    property ZValues;
    { events }
    property OnGetYValue;
    property OnGetColor;
  end;

  TVector3DSeries=class(TCustom3DPaletteSeries)
  private
    FArrowHeight : Integer;
    FArrowWidth  : Integer;
    FStartArrow  : TChartHiddenPen;
    FEndArrow    : TChartPen;
    FEndXValues  : TChartValueList; { <-- Vector end X values }
    FEndYValues  : TChartValueList; { <-- Vector end Y values }
    FEndZValues  : TChartValueList;

    procedure SetArrowHeight(const Value: Integer);
    procedure SetArrowWidth(const Value: Integer);
    Procedure SetEndXValues(Value:TChartValueList);
    Procedure SetEndYValues(Value:TChartValueList);
    Procedure SetEndZValues(Value:TChartValueList);
    procedure SetEndArrow(const Value: TChartPen);
    procedure SetStartArrow(const Value: TChartHiddenPen);
  protected
    Procedure AddSampleValues(NumValues:Integer; OnlyMandatory:Boolean=False); override;
    procedure DrawValue(ValueIndex:Integer); override; { <-- main draw method }
    class Function GetEditorClass:String; override;
  public
    Constructor Create(AOwner: TComponent); override;
    Destructor Destroy; override;

    Procedure Assign(Source:TPersistent); override;

    Function AddVector(Const X0,Y0,Z0,X1,Y1,Z1:Double; Const ALabel:String='';
                     AColor:TColor=clTeeColor):Integer; overload;
    Function IsValidSourceOf(Value:TChartSeries):Boolean; override;
    Function MaxXValue:Double; override;
    Function MinXValue:Double; override;
    Function MaxYValue:Double; override;
    Function MinYValue:Double; override;
    Function MaxZValue:Double; override;
    Function MinZValue:Double; override;
    Function NumSampleValues:Integer; override;
  published
    { Published declarations }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -