Graphic.getDojoShape() does not work in js api 4.6

1044
6
01-31-2018 02:15 AM
SergeyVladimirov
New Contributor II

function Graphic.getDojoShape() works fine in js api 3. but it does not work in 4.6 . Is there any way to solve this issue?

0 Kudos
6 Replies
KenBuja
MVP Esteemed Contributor

According to the Functionality Matrix, this ability isn't planned for the 4.x release

SergeyVladimirov
New Contributor II

Yes, i seen that. But i used this function, and now i am not sure how to change my code to get it working .

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sergey,

   So you are saying you do not know how to use symbolPreview?

0 Kudos
SergeyVladimirov
New Contributor II

I am not sure that symbolPreview is what i need.  All that i need is to highlight some layer with animation. For that i use "graphicFlash.getDojoShape()" because then i pass this to dojoFx; Let me show some part of my code.

let rLayer = this.sharedService.map.getLayer(x);
let items: any[] = rLayer.graphics;//.filter(x => this.sharedService.map.extent.intersects(x._extent));

items.forEach(graphicHighlight => {
let graphicFlash;
switch (graphicHighlight.geometry.type) {
case "point": case "esriGeometryMultipoint":
..................
case "multipoint":
............................
case "polyline":
.......................................
case "polygon": case "extent":
var symbolFlashPolygon = new this.SimpleFillSymbol(this.SimpleFillSymbol.STYLE_SOLID,
new this.SimpleLineSymbol(this.SimpleLineSymbol.STYLE_SOLID, new this.mapLayerService.Color([255, 0, 0]), 2),
new this.mapLayerService.Color([255, 0, 0, 0.25]));
_extent = graphicHighlight.geometry.getExtent();
graphicFlash = new this.Graphic(graphicHighlight.geometry, symbolFlashPolygon);
break;
}
if (this.sharedService.map.extent.intersects(_extent)) {
this.sharedService.map.graphics.add(graphicFlash);


let shape = graphicFlash.getDojoShape();   

if (shape != null) {
let animStroke = this.dojoFx.animateStroke({
shape: shape,
duration: 10000,
color: { end: new this.mapLayerService.Color([0, 0, 0, 0]) }
});
var animFill: any;
if (isLine) {
animFill = this.dojoFx.animateTransform({
shape: shape,
duration: 1000,
color: { end: new this.mapLayerService.Color([0, 0, 0, 0]) }
// color: { start: "red", end: color }
});
} else {
animFill = this.dojoFx.animateFill({
shape: shape,
duration: 1000,
color: { end: new this.mapLayerService.Color([0, 0, 0, 0]) }
//color: { start: "red", end: color }
});
}

var anim = this.coreFx.combine([animStroke, animFill]).play();
this.aspect.after(anim, "onEnd", function () {
self.sharedService.map.graphics.remove(graphicFlash);
});
}
}

});

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

Sergey,

   Based on the fact that getDojoShape is not planed for the 4.x api I am not sure how you would be able to do that in 4.x. The symbolPreview produced a HTML element not a svg shape.

0 Kudos
RobertScheitlin__GISP
MVP Emeritus

If you are just looking to get the swatches (like what is used in the legend) then you need to use symbolPreview.

0 Kudos