|
@@ -13,43 +13,43 @@ export class SImageMarkerItem extends SImageItem {
|
|
|
data: Marker;
|
|
|
|
|
|
/** x轴缩放属性 */
|
|
|
- _scaleX: number = 1;
|
|
|
- get scaleX(): number {
|
|
|
- return this._scaleX;
|
|
|
- }
|
|
|
- set scaleX(v: number) {
|
|
|
- this._scaleX = v;
|
|
|
- if (this.data.Scale) {
|
|
|
- this.data.Scale.X = v;
|
|
|
- }
|
|
|
- this.update();
|
|
|
- }
|
|
|
+ // _scaleX: number = 1;
|
|
|
+ // get scaleX(): number {
|
|
|
+ // return this._scaleX;
|
|
|
+ // }
|
|
|
+ // set scaleX(v: number) {
|
|
|
+ // this._scaleX = v;
|
|
|
+ // if (this.data.Scale) {
|
|
|
+ // this.data.Scale.X = v;
|
|
|
+ // }
|
|
|
+ // this.update();
|
|
|
+ // }
|
|
|
|
|
|
/** y轴缩放属性 */
|
|
|
- _scaleY: number = 1;
|
|
|
- get scaleY(): number {
|
|
|
- return this._scaleY;
|
|
|
- }
|
|
|
- set scaleY(v: number) {
|
|
|
- this._scaleY = v;
|
|
|
- if (this.data.Scale) {
|
|
|
- this.data.Scale.Y = v;
|
|
|
- }
|
|
|
- this.update();
|
|
|
- }
|
|
|
+ // _scaleY: number = 1;
|
|
|
+ // get scaleY(): number {
|
|
|
+ // return this._scaleY;
|
|
|
+ // }
|
|
|
+ // set scaleY(v: number) {
|
|
|
+ // this._scaleY = v;
|
|
|
+ // if (this.data.Scale) {
|
|
|
+ // this.data.Scale.Y = v;
|
|
|
+ // }
|
|
|
+ // this.update();
|
|
|
+ // }
|
|
|
|
|
|
/** y轴旋转属性 */
|
|
|
- _rolate: number = 0;
|
|
|
- get rolate(): number {
|
|
|
- return this._rolate;
|
|
|
- }
|
|
|
- set rolate(v: number) {
|
|
|
- this._rolate = v;
|
|
|
- if (this.data.Rolate) {
|
|
|
- this.data.Rolate.Z = v;
|
|
|
- }
|
|
|
- this.update();
|
|
|
- }
|
|
|
+ // _rolate: number = 0;
|
|
|
+ // get rolate(): number {
|
|
|
+ // return this._rolate;
|
|
|
+ // }
|
|
|
+ // set rolate(v: number) {
|
|
|
+ // this._rolate = v;
|
|
|
+ // if (this.data.Rolate) {
|
|
|
+ // this.data.Rolate.Z = v;
|
|
|
+ // }
|
|
|
+ // this.update();
|
|
|
+ // }
|
|
|
|
|
|
// set name(v: string) {
|
|
|
// this.data.Name = v;
|
|
@@ -90,68 +90,23 @@ export class SImageMarkerItem extends SImageItem {
|
|
|
constructor(parent: SGraphItem | null, data: Marker) {
|
|
|
super(parent);
|
|
|
this.data = data;
|
|
|
+ this.id = data.ID;
|
|
|
this.moveTo(data.Pos.X, data.Pos.Y);
|
|
|
- if (this.data.Scale) {
|
|
|
- this.scaleX = this.data.Scale.X;
|
|
|
- this.scaleY = this.data.Scale.Y;
|
|
|
- }
|
|
|
- if (this.data.Rolate && this.data.Rolate.Z) {
|
|
|
- this.rolate = this.data.Rolate.Z;
|
|
|
- }
|
|
|
- if (this.data.Size) {
|
|
|
- this.width = this.data.Size.Width;
|
|
|
- this.height = this.data.Size.Height;
|
|
|
- }
|
|
|
- if (this.data.Properties && this.data.Properties.Url) {
|
|
|
- // if (this.data.Properties.Url instanceof String) {
|
|
|
-
|
|
|
- // }
|
|
|
- this.url = this.data.Properties.Url;
|
|
|
+ // if (data.Scale) {
|
|
|
+ // this.scaleX = data.Scale.X;
|
|
|
+ // this.scaleY = data.Scale.Y;
|
|
|
+ // }
|
|
|
+ // if (data.Rolate && data.Rolate.Z) {
|
|
|
+ // this.rolate = data.Rolate.Z;
|
|
|
+ // }
|
|
|
+ if (data.Size) {
|
|
|
+ this.width = data.Size.Width;
|
|
|
+ this.height = data.Size.Height;
|
|
|
}
|
|
|
- } // Constructor
|
|
|
-
|
|
|
- /**
|
|
|
- * Item绘制操作
|
|
|
- *
|
|
|
- * @param painter 绘画类
|
|
|
- */
|
|
|
- onDraw(painter: SPainter): void {
|
|
|
- if (this.img) {
|
|
|
- // 要绘制图片的宽度
|
|
|
- let width = 0;
|
|
|
- // 要绘制图片的宽度
|
|
|
- let height = 0;
|
|
|
- // 图片item的宽高比
|
|
|
- let itemAspectRatio: number = this.width / this.height;
|
|
|
- // 原始图片的宽高比
|
|
|
- let imgAspectRatio: number =
|
|
|
- (this.img.width as number) / (this.img.height as number);
|
|
|
- // 原始图片的高宽比
|
|
|
- let imgHwRatio: number =
|
|
|
- (this.img.height as number) / (this.img.width as number);
|
|
|
- if (this.showType == SImageShowType.Full) {
|
|
|
- width = this.width;
|
|
|
- height = this.height;
|
|
|
- } else if (this.showType == SImageShowType.Equivalency) {
|
|
|
- if (itemAspectRatio > imgAspectRatio) {
|
|
|
- height = this.height;
|
|
|
- width = imgAspectRatio * height;
|
|
|
- } else if (itemAspectRatio < imgAspectRatio) {
|
|
|
- width = this.width;
|
|
|
- height = width * imgHwRatio;
|
|
|
- } else {
|
|
|
- width = this.width;
|
|
|
- height = this.height;
|
|
|
- }
|
|
|
- } else if (this.showType == SImageShowType.AutoFit) {
|
|
|
- this.width = this.img.width as number;
|
|
|
- this.height = this.img.height as number;
|
|
|
- width = this.width;
|
|
|
- height = this.height;
|
|
|
+ if (data.Properties && data.Properties.Url) {
|
|
|
+ if (data.Properties.Url instanceof String) {
|
|
|
+ this.url = data.Properties.Url;
|
|
|
}
|
|
|
- painter.scale(this.scaleX, this.scaleY);
|
|
|
- painter.rotate(this.rolate);
|
|
|
- painter.drawImage(this.img, -width / 2, -height / 2, width, height);
|
|
|
}
|
|
|
- } // Function onDraw()
|
|
|
+ } // Constructor
|
|
|
} // Class SImageMarkerItem
|