But once I figure out how to create the geometry and then make the translation from map to screen coordinates, I feel like I’m back close to the same problem: how do I determine if it should be shown or hidden?
Also, in response to walter’s comment:
If the Part is a “Position” Panel and consists of one Shape (or more) with Shape.isGeometryPositioned set to true, you can convert a Point in the Geometry to document coordinates by adding the Part.position.
I am not sure what you mean when you say convert geometry to doc coordinates by adding the position.
Here’s my relevant logic to assign geometry based on my understanding of typical latlong to point conversions:
Shape section of Part:’
$(go.Shape, new go.Binding('stroke', '', (d) => { if (d.highlighted) { return 'red'; } return d.symbolColor; }), new go.Binding('geometry', '', (d) => this.buildLineGeometry(d)), new go.Binding('figure', 'symbolShape'), { isGeometryPositioned: true, width: 11, strokeWidth: 3, isPanelMain: true, cursor: 'pointer', name: 'shapeMarker', height: 11, margin: 5, }),
Build geometry function:
`
buildLineGeometry(d: IGoJsDiagramLineData): go.Geometry {
let latlongs = d.points;
if (!latlongs) return new go.Geometry();
let point = this.map.latLngToContainerPoint(latlongs[0] as L.LatLngExpression);
let fig = new go.PathFigure(point.x, point.y); //the start of the path, x and y
for (let i = 2; i < latlongs.length - 2; i += 2) {
let p = this.map.latLngToContainerPoint(latlongs[i] as L.LatLngExpression);
fig.add(new go.PathSegment(go.PathSegment.Line, p.x, p.y));
}
return new go.Geometry().add(fig);
}
`
Thanks again for your help.