Example #1
0
        protected override InteractiveResult MouseMoveCore(InteractionArguments interactionArguments)
        {
            InteractiveResult result = new InteractiveResult();

            if (ControlPointType != ControlPointType.None)
            {
                if (startPoint == null)
                {
                    return(result);
                }
                else
                {
                    PointShape currentPoint = new PointShape(interactionArguments.WorldX, interactionArguments.WorldY);
                    double     xOffset      = currentPoint.X - startPoint.X;
                    double     yOffset      = currentPoint.Y - startPoint.Y;

                    Collection <Feature> features = new Collection <Feature>();

                    int index = 0;
                    System.Diagnostics.Debug.WriteLine("ids count");
                    foreach (int id in ids)
                    {
                        System.Diagnostics.Debug.WriteLine(id.ToString());
                    }
                    if (ids.Count == 0)
                    {
                        foreach (Feature feature in ExistingControlPointsLayer.InternalFeatures)
                        {
                            if (feature.ColumnValues.ContainsKey("IsSelected") && feature.ColumnValues["IsSelected"] == "true")
                            {
                                features.Add(feature);
                                ids.Add(index);
                            }
                            index++;
                        }
                    }
                    else
                    {
                        foreach (int id in ids)
                        {
                            features.Add(ExistingControlPointsLayer.InternalFeatures[id]);
                        }
                    }

                    foreach (Feature feature in features)
                    {
                        PointShape oldPoint    = feature.GetShape() as PointShape;
                        PointShape targetPoint = new PointShape(oldPoint.X + xOffset, oldPoint.Y + yOffset);
                        EditShapesLayer.InternalFeatures[0] = MoveVertex(EditShapesLayer.InternalFeatures[0], oldPoint, targetPoint);
                    }

                    CalculateAllControlPoints();

                    startPoint = currentPoint.CloneDeep() as PointShape;
                    bool existingNode = false;
                    foreach (string key in EditShapesLayer.InternalFeatures.GetKeys())
                    {
                        if (string.Equals(EditShapesLayer.InternalFeatures[key].Id, OriginalEditingFeature.Id, StringComparison.OrdinalIgnoreCase))
                        {
                            Lock.EnterWriteLock();
                            try
                            {
                                EditShapesLayer.InternalFeatures[key] = EditShapesLayer.InternalFeatures[0];
                            }
                            finally
                            {
                                Lock.ExitWriteLock();
                            }
                            foreach (string featureKey in ExistingControlPointsLayer.InternalFeatures.GetKeys())
                            {
                                Feature feature = ExistingControlPointsLayer.InternalFeatures[featureKey];
                                if (feature.ColumnValues != null)
                                {
                                    if (feature.ColumnValues["state"] == "selected")
                                    {
                                        existingNode = true;
                                    }
                                }
                            }
                            ShowAllControlPointLayers(false, existingNode);
                            break;
                        }
                    }

                    result.DrawThisOverlay          = InteractiveOverlayDrawType.Draw;
                    result.ProcessOtherOverlaysMode = ProcessOtherOverlaysMode.DoNotProcessOtherOverlays;
                }
            }

            return(result);
        }