ThinkGeo.com    |     Documentation    |     Premium Support

EditInteractiveOverlay.MoveVertexCore

I have overridden the CalculateVertexControlPointsCore to add my control points and have overridden MoveVertexCore to handle the move of one of the control points.  I would like to be able to put an identification on the control points so I can tell which one is being moved but the data is being taken off....I tried using Tag and Id but the Tag becomes null and the Id is replaced with the featureid??? by the time the sourceControlPoint is handed down to MoveVertexCore.


Any way to go about doing this or can we fix the Tag so it is passed through?


Thanks.



David,


Thanks for your post. This is some advanced topic to create and have your own EditOverlay.
 
Hope my following answers and codes can give you some help to move forward.
 
We will create new features without copy there tag information, so it would be taken off which seems can be enhanced somehow. But we leave the ColumnValues of the control point feature to record any information of the corresponding vertex, in which you can add as many information as you want.
Following contains some sample codes which I will record the original vertex coordinates information. We only deal with the PolygonShape without pay any attention to other type of feature. Just take a reference.


protected override IEnumerable<Feature> CalculateVertexControlPointsCore(Feature feature)
        {
            WellKnownType wellKnowType = feature.GetWellKnownType();
            IEnumerable<Feature> returnValues = new Collection<Feature>();
        
            returnValues = CaculateVertexControlPointsForPolygonTypeFeature(feature);
                   
            return returnValues;
        }

        private static IEnumerable<Feature> CaculateVertexControlPointsForPolygonTypeFeature(Feature polygonFeature)
        {
            Collection<Feature> returnValues = new Collection<Feature>();

            PolygonShape polygonShape = polygonFeature.GetShape() as PolygonShape;
            RectangleShape boundingBox = polygonShape.GetBoundingBox();

            RingShape outRing = polygonShape.OuterRing;
            for (int k = 0; k < outRing.Vertices.Count; k++)
            {
                Feature reshapeFeature = new Feature(outRing.Vertices[k].X + 10.0, outRing.Vertices[k].Y);
                
                reshapeFeature.ColumnValues.Add("OriginalX", outRing.Vertices[k].X.ToString());
                reshapeFeature.ColumnValues.Add("OriginalY", outRing.Vertices[k].Y.ToString());
                returnValues.Add(reshapeFeature);
            }

            for (int j = 0; j < polygonShape.InnerRings.Count; j++)
            {
                RingShape innerRing = polygonShape.InnerRings[j];
                for (int k = 0; k < innerRing.Vertices.Count; k++)
                {
                    Feature reshapeFeature = new Feature(innerRing.Vertices[k].X + 10.0, innerRing.Vertices[k].Y);
                    reshapeFeature.ColumnValues.Add("OriginalX", innerRing.Vertices[k].X.ToString());
                    reshapeFeature.ColumnValues.Add("OriginalY", innerRing.Vertices[k].Y.ToString());
                    returnValues.Add(reshapeFeature);
                }
            }

            return returnValues;
        }

Any more questions just let me know.


 
Thanks.
 
Yale.

Maybe I'm missing something because I thought of that after my first post and tried it (actually, I think I tried that originally too).  I do a sourceControlPoint.GetFeature() in MoveVertexCore but the returned feature has been stripped of ColumnValues.  I can see the ColumnValues set in the returned collection from CalculateVertexControlPointsCore but the feature that I get back from sourceControlPoint.GetFeature() has no ColumnValues.



David, 


I think we are very near to our target.
 
Just try SelectControlPointFeature property in the MoveVertexCore instead of using the sourceControlPoint.GetFeature().
 
 If any more questions just let me know.
 
Thanks.
 
Yale

Yale,


Thanks.  That is what I was looking for.  This will make my code  much cleaner.


Dave


 


 



David, 
  
 You are welcome. 
  
 Any more questions just let me know. I was my please to work with you. 
  
 Thanks. 
  
 Yale