📄 teemapseries.pas
字号:
Polyline(IPoints,tmpZ);
end
else
begin
if Self.Closed then
Polygon(IPoints)
else
Polyline(IPoints);
end;
end;
if ATransp>0 then
ACanvas.EndBlending(tmpBlend);
end;
{ Draw the polygon... }
procedure TTeePolygon.Draw(ACanvas: TCanvas3D; ValueIndex:Integer);
var tmpColor : TColor;
begin
if FPoints.Active and (FPoints.Count>0) and Visible then
begin
// set pen and brush...
if ParentPen then ACanvas.AssignVisiblePen(ParentSeries.Pen)
else ACanvas.AssignVisiblePen(Pen);
// 8.0
tmpColor:=ParentSeries.ValueColor[ValueIndex];
if tmpColor=clNone then // TV52011444
ACanvas.Brush.Style:=bsClear
else
if ParentBrush then ACanvas.AssignBrush(ParentSeries.Brush,tmpColor)
else ACanvas.AssignBrush(Brush,tmpColor);
GetPoints;
DoDraw(ACanvas,ValueIndex,tmpColor,Transparency,True);
end;
end;
function TTeePolygon.GetBrush: TChartBrush;
begin
result:=FPoints.Brush;
end;
function TTeePolygon.GetColor: TColor;
begin
result:=ParentSeries.ValueColor[Index];
end;
function TTeePolygon.GetPen: TChartPen;
begin
result:=FPoints.Pen;
end;
procedure TTeePolygon.SetBrush(const Value: TChartBrush);
begin
FPoints.Brush:=Value;
end;
procedure TTeePolygon.SetColor(const Value: TColor);
begin
Points.SeriesColor:=Value;
end;
procedure TTeePolygon.SetClosed(const Value: Boolean);
begin
ParentSeries.SetBooleanProperty(FClosed,Value);
end;
Function TTeePolygon.GetGradient: TChartGradient;
begin
if not Assigned(FGradient) then
FGradient:=TChartGradient.Create({$IFNDEF CLR}TSeriesAccess(ParentSeries).{$ENDIF}CanvasChanged);
result:=FGradient;
end;
procedure TTeePolygon.SetGradient(const Value: TChartGradient);
begin
if Assigned(Value) then
Gradient.Assign(Value)
else
FreeAndNil(FGradient);
end;
procedure TTeePolygon.SetPen(const Value: TChartPen);
begin
FPoints.Pen:=Value;
end;
procedure TTeePolygon.SetZ(const Value: Double);
begin
with ParentSeries do
begin
ZValues.Value[Index]:=Value;
ZValues.Modified:=True; // 7.06
Repaint;
end;
end;
function TTeePolygon.GetZ: Double;
begin
result:=ParentSeries.ZValues.Value[Index];
end;
function TTeePolygon.GetText: String;
begin
result:=ParentSeries.Labels[Index];
end;
procedure TTeePolygon.SetText(const Value: String);
begin
ParentSeries.Labels[Index]:=Value;
end;
procedure TTeePolygon.SetParentBrush(const Value: Boolean);
begin
ParentSeries.SetBooleanProperty(FParentBrush,Value);
end;
procedure TTeePolygon.SetParentPen(const Value: Boolean);
begin
ParentSeries.SetBooleanProperty(FParentPen,Value);
end;
(*
function TTeePolygon.ZPosition:Integer;
var x : Integer;
y : Integer;
P : TPoint;
tmpZ : Integer;
begin
result:=0;
With ParentSeries do
if FPoints.Count>0 then
begin
X:=GetHorizAxis.CalcPosValue(FPoints.XValues.Value[0]);
Y:=GetVertAxis.CalcPosValue(FPoints.YValues.Value[0]);
tmpZ:=ParentSeries.CalcZPos(0);
P:=ParentSeries.ParentChart.Canvas.Calculate3DPosition(TeePoint(x,y),tmpZ);
end;
end;
*)
function TTeePolygon.Bounds: TRect; // 7.0
begin
result:=PolygonBounds(GetPoints);
end;
{$IFDEF CLR}
procedure TTeePolygon.CanvasChanged(Sender: TObject);
begin
ParentSeries.Repaint;
end;
{$ENDIF}
procedure TTeePolygon.SetTransparency(const Value: TTeeTransparency);
begin
if FTransparency<>Value then
begin
FTransparency:=Value;
ParentSeries.Repaint;
end;
end;
procedure TTeePolygon.DefineProperties(Filer: TFiler);
begin
inherited;
Filer.DefineBinaryProperty('Data', Points.ReadData, Points.WriteData,
ParentSeries.ManualData);
end;
function TTeePolygon.GetTransparent: Boolean;
var tmp : TBrush;
begin
if ParentBrush then tmp:=ParentSeries.Brush
else tmp:=Brush;
result:=tmp.Style=bsClear;
end;
procedure TTeePolygon.SetTransparent(const Value: Boolean);
begin
ParentBrush:=False;
if Value then
Brush.Style:=bsClear
else
Brush.Style:=bsSolid;
end;
{ TTeePolygonList }
type TComponentAccess=class(TComponent);
function TTeePolygonList.Add: TTeePolygon;
{$IFNDEF CLR}
var p : TPolygonSeries;
{$ENDIF}
begin
result:=inherited Add as TTeePolygon;
{$IFNDEF CLR}
p:=result.Points;
TComponentAccess(p).SetDesigning(False);
{$ENDIF}
end;
procedure TTeePolygonList.Delete(Start, Quantity: Integer);
var t: Integer;
begin
for t:=1 to Quantity do Items[Start].Free;
end;
function TTeePolygonList.Get(Index: Integer): TTeePolygon;
begin
result:=TTeePolygon(Items[Index]);
end;
function TTeePolygonList.GetByName(const AName: String): TTeePolygon;
var t : Integer;
tmp : String;
begin
result:=nil;
tmp:=UpperCase(AName);
for t:=0 to Count-1 do
if UpperCase(Polygon[t].Text)=tmp then
begin
result:=Polygon[t];
break;
end;
end;
function TTeePolygonList.Owner: TMapSeries;
begin
result:=TMapSeries(GetOwner);
end;
procedure TTeePolygonList.Put(Index: Integer; const Value: TTeePolygon);
begin
Items[Index]:=Value;
end;
{ TMapSeries }
Constructor TMapSeries.Create(AOwner: TComponent);
begin
inherited;
FShadow:=TTeeShadow.Create(CanvasChanged);
FShapes:=TTeePolygonList.Create(Self,TTeePolygon);
FPointSize:=1;
ZValues.Name:=TeeMsg_Value;
CalcVisiblePoints:=False;
YMandatory:=False;
MandatoryValueList:=ZValues;
end;
Destructor TMapSeries.Destroy;
begin
FreeAndNil(FShapes);
FShadow.Free;
inherited;
end;
procedure TMapSeries.Assign(Source:TPersistent);
var t : Integer;
begin
inherited;
if Source is TMapSeries then
begin
FPointSize:=TMapSeries(Source).FPointSize;
Shadow:=TMapSeries(Source).Shadow;
FTransparency:=TMapSeries(Source).FTransparency;
FTransparent:=TMapSeries(Source).FTransparent;
for t:=0 to TMapSeries(Source).Count-1 do
Shapes.Add.Points.Assign(TMapSeries(Source).Polygon[t].Points);
end;
end;
procedure TMapSeries.SetShadow(const Value: TTeeShadow);
begin
FShadow.Assign(Value);
end;
procedure TMapSeries.DefineProperties(Filer: TFiler);
begin
DontSaveData:=not CanSaveData;
ForceSaveData:=False;
inherited;
end;
procedure TMapSeries.DrawValue(ValueIndex: Integer);
begin
if Shapes.Count>ValueIndex then
Shapes[ValueIndex].Draw(ParentChart.Canvas,ValueIndex);
end;
Procedure TMapSeries.Delete(ValueIndex:Integer);
begin
inherited;
if Assigned(FShapes) then
Shapes[ValueIndex].Free;
end;
Procedure TMapSeries.Delete(Start,Quantity:Integer; RemoveGap:Boolean=False);
begin
inherited;
if Assigned(FShapes) then
FShapes.Delete(Start,Quantity);
end;
function TMapSeries.MaxXValue: Double;
var t : Integer;
begin
if Shapes.Count=0 then result:=0
else
begin
result:=Shapes[0].FPoints.MaxXValue;
for t:=1 to Shapes.Count-1 do
result:=Math.Max(result,Shapes[t].FPoints.MaxXValue);
end;
end;
function TMapSeries.MaxYValue: Double;
var t : Integer;
begin
if Shapes.Count=0 then result:=0
else
begin
result:=Shapes[0].FPoints.MaxYValue;
for t:=1 to Shapes.Count-1 do
result:=Math.Max(result,Shapes[t].FPoints.MaxYValue);
end;
end;
function TMapSeries.MinXValue: Double;
var t : Integer;
begin
if Shapes.Count=0 then result:=0
else
begin
result:=Shapes[0].FPoints.MinXValue;
for t:=1 to Shapes.Count-1 do
result:=Math.Min(result,Shapes[t].FPoints.MinXValue);
end;
end;
function TMapSeries.MinYValue: Double;
var t : Integer;
begin
if Shapes.Count=0 then result:=0
else
begin
result:=Shapes[0].FPoints.MinYValue;
for t:=1 to Shapes.Count-1 do
result:=Math.Min(result,Shapes[t].FPoints.MinYValue);
end;
end;
procedure TMapSeries.PrepareForGallery(IsEnabled:Boolean);
var t : Integer;
begin
inherited;
if not IsEnabled then
for t:=0 to Count-1 do Shapes[t].Color:=clSilver;
end;
procedure TMapSeries.SwapValueIndex(a,b:Integer);
begin
inherited;
Shapes[a].Index:=b;
Repaint;
end;
procedure TMapSeries.SetPointSize(const Value: Integer);
begin
SetIntegerProperty(FPointSize,Value);
end;
procedure TMapSeries.SetShapes(const Value: TTeePolygonList);
begin
FShapes.Assign(Value);
end;
procedure TMapSeries.CalcHorizMargins(var LeftMargin,
RightMargin: Integer);
begin
inherited;
if Pen.Visible then
begin
Inc(LeftMargin,Pen.Width);
Inc(RightMargin,Pen.Width);
end;
end;
procedure TMapSeries.CalcVerticalMargins(var TopMargin,
BottomMargin: Integer);
begin
inherited;
Inc(BottomMargin);
if Pen.Visible then
begin
Inc(TopMargin,Pen.Width);
Inc(BottomMargin,Pen.Width);
end;
end;
Function TMapSeries.NumSampleValues;
begin
result:=12;
end;
procedure TMapSeries.AddSampleValues(NumValues: Integer; OnlyMandatory:Boolean=False);
Procedure AddShape(Const X,Y:Array of Integer; Const AText:String);
var t : Integer;
tmpX : Integer;
tmpY : Integer;
begin
if Count>NumSampleValues then
begin
tmpX:=RandomValue(NumSampleValues);
tmpY:=RandomValue(NumSampleValues);
end
else
begin
tmpX:=0;
tmpY:=0;
end;
With Shapes.Add do
begin
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -