public override bool MoveTracker(ITrackerFeature trackerFeature, double deltaX, double deltaY, ISnapResult snapResult) { if (trackerFeature == AllTracker) { int index = -1; IList <int> handles = new List <int>(); IList <IGeometry> geometries = new List <IGeometry>(); for (int i = 0; i < trackers.Count; i++) { geometries.Add(trackers[i].Geometry); //if (trackers[i].Selected) { handles.Add(i); } if (trackers[i] == trackerFeature) { index = i; } } if (0 == handles.Count) { return(false); } if (null == FallOffPolicy) { FallOffPolicy = new NoFallOffPolicy(); } FallOffPolicy.Move(TargetFeature.Geometry, geometries, handles, index, deltaX, deltaY); foreach (IFeatureRelationEditor topologyRule in TopologyRules) { topologyRule.UpdateRelatedFeatures(SourceFeature, TargetFeature.Geometry, new List <int> { 0 }); } return(true); } return(base.MoveTracker(trackerFeature, deltaX, deltaY, snapResult)); }
public virtual bool MoveTracker(TrackerFeature trackerFeature, double deltaX, double deltaY, SnapResult snapResult = null) { if (trackerFeature.Index == -1) { throw new ArgumentException("Can not find tracker; can not move."); } var handles = SelectedTrackerIndices.ToList(); if (handles.Count == 0) { return(false); // Do not throw exception, can occur in special cases when moving with CTRL toggle selection } if (FallOffPolicy != null) { FallOffPolicy.Move(TargetFeature.Geometry, trackers.Select(t => t.Geometry).ToList(), handles, trackerFeature.Index, deltaX, deltaY); } else { GeometryHelper.MoveCoordinate(TargetFeature.Geometry, trackerFeature.Index, deltaX, deltaY); TargetFeature.Geometry = TargetFeature.Geometry; // fire event GeometryHelper.MoveCoordinate(trackerFeature.Geometry, 0, deltaX, deltaY); trackerFeature.Geometry = trackerFeature.Geometry; // fire event } foreach (var topologyRule in FeatureRelationEditors) { topologyRule.UpdateRelatedFeatures(SourceFeature, TargetFeature.Geometry, handles); } return(true); }
public override bool MoveTracker(TrackerFeature trackerFeature, double deltaX, double deltaY, SnapResult snapResult = null) { if (trackerFeature == AllTracker) { if (FallOffPolicy == null) { FallOffPolicy = new NoFallOffPolicy(); } var handles = TrackerIndices.ToList(); FallOffPolicy.Move(TargetFeature.Geometry, Trackers.Select(t => t.Geometry).ToList(), handles, -1, deltaX, deltaY); foreach (var topologyRule in FeatureRelationEditors) { topologyRule.UpdateRelatedFeatures(SourceFeature, TargetFeature.Geometry, handles); } return(true); } return(base.MoveTracker(trackerFeature, deltaX, deltaY, snapResult)); }
private void updeetGeometries(bool final, IList <IFeature> relatedNewFeatures, IFeature feature, IGeometry newGeometry, IList <int> trackerIndices) { int index = 0; INode node; if (null != (node = (feature as INode))) { if (feature != lastFeature) { throw new ArgumentException("You must call FillRelatedFeature first!"); } double deltaX = newGeometry.Coordinates[0].X - lastCoordinate.X; double deltaY = newGeometry.Coordinates[0].Y - lastCoordinate.Y; for (int b = 0; b < node.IncomingBranches.Count; b++) { IBranch branch = node.IncomingBranches[b]; IGeometry geometry = lastRelatedFeatureGeometries[index]; FallOffPolicy.Reset(); // use the move method of FallOfPolicy that uses a source and target geometry if (final) { FallOffPolicy.Move(relatedNewFeatures[index], geometry, geometry.Coordinates.Length - 1, deltaX, deltaY); } else { FallOffPolicy.Move(relatedNewFeatures[index].Geometry, geometry, geometry.Coordinates.Length - 1, deltaX, deltaY); } List <int> branchTrackerIndices = new List <int> { branch.Geometry.Coordinates.Length - 1 }; for (int i = 0; i < activeInRules[b].Count; i++) { if (final) { activeInRules[b][i].StoreRelatedFeatures(branch, relatedNewFeatures[index].Geometry, branchTrackerIndices); } else { activeInRules[b][i].UpdateRelatedFeatures(branch, relatedNewFeatures[index].Geometry, branchTrackerIndices); } } index++; } for (int b = 0; b < node.OutgoingBranches.Count; b++) { IBranch branch = node.OutgoingBranches[b]; IGeometry geometry = lastRelatedFeatureGeometries[index]; FallOffPolicy.Reset(); if (final) { FallOffPolicy.Move(relatedNewFeatures[index], geometry, 0, deltaX, deltaY); } else { FallOffPolicy.Move(relatedNewFeatures[index].Geometry, geometry, 0, deltaX, deltaY); } List <int> branchTrackerIndices = new List <int> { 0 }; for (int i = 0; i < activeOutRules[b].Count; i++) { if (final) { activeOutRules[b][i].StoreRelatedFeatures(branch, relatedNewFeatures[index].Geometry, branchTrackerIndices); } else { activeOutRules[b][i].UpdateRelatedFeatures(branch, relatedNewFeatures[index].Geometry, branchTrackerIndices); } } index++; } } }