Exemplo n.º 1
0
        private void InitSubEntries()
        {
            ArrayList gp = new ArrayList();

            // wenn der Pfad zu viele Eckpunkte hat, gibts Probleme mit der WindowHandles
            for (int i = 0; i <= path.CurveCount; ++i) // mit Endpunkt
            {
                GeoPointProperty vertex = new GeoPointProperty("Path.Vertex", Frame, true);
                vertex.UserData.Add("Index", i);
                vertex.GetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetVertexPoint);
                vertex.SetGeoPointEvent               += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetVertexPoint);
                vertex.ModifyWithMouseEvent           += new ModifyWithMouseDelegate(ModifyVertexWithMouse);
                vertex.PropertyEntryChangedStateEvent += new PropertyEntryChangedStateDelegate(OnVertexStateChanged);
                vertex.GeoPointChanged();
                if (path.IsClosed)
                {
                    vertex.PrependContextMenu = MenuResource.LoadMenuDefinition("MenuId.Path.Vertex", false, new VertexCommandHandler(this, i));
                }

                gp.Add(vertex);
            }
            area                 = new DoubleProperty("Path.Area", Frame);
            area.ReadOnly        = true;
            area.GetDoubleEvent += new CADability.UserInterface.DoubleProperty.GetDoubleDelegate(OnGetArea);
            area.Refresh();
            gp.Add(area);
            length                 = new DoubleProperty("Path.Length", Frame);
            length.ReadOnly        = true;
            length.GetDoubleEvent += new CADability.UserInterface.DoubleProperty.GetDoubleDelegate(OnGetLength);
            length.Refresh();
            gp.Add(length);
            subEntries          = (IPropertyEntry[])gp.ToArray(typeof(IPropertyEntry));
            attributeProperties = path.GetAttributeProperties(Frame);
        }
Exemplo n.º 2
0
 void OnCreateContextMenueChild(IGeoObjectShowProperty sender, List <MenuWithHandler> toManipulate)
 {
     ContextMenuSource = sender.GetGeoObject();
     MenuWithHandler[] toAdd = MenuResource.LoadMenuDefinition("MenuId.SelectedObject", false, Frame.CommandHandler);
     toManipulate.AddRange(toAdd);
 }
Exemplo n.º 3
0
 /// <summary>
 /// Will be called when a context menu of a sub entry has been generated. This implementation adds the standard menu entries for selected objects.
 /// </summary>
 /// <param name="sender">The ControlCenter entry that has its context menu created</param>
 /// <param name="toManipulate">The context menu, which may be manipulated</param>
 protected void OnCreateSubContextMenue(IGeoObjectShowProperty sender, List <MenuWithHandler> toManipulate)
 {
     ContextMenuSource = sender.GetGeoObject();
     toManipulate.Add(MenuWithHandler.Separator);
     toManipulate.AddRange(MenuResource.LoadMenuDefinition("MenuId.SelectedObject", false, Frame.CommandHandler));
 }
Exemplo n.º 4
0
        private void InitSubEntries()
        {
            vertexProperty = new MultiGeoPointProperty(new VertexIndexedGeoPoint(this), "Polyline.Vertex", this.Frame);
            vertexProperty.ModifyWithMouseEvent          += new CADability.UserInterface.MultiGeoPointProperty.ModifyWithMouseIndexDelegate(OnModifyVertexWithMouse);
            vertexProperty.GeoPointSelectionChangedEvent += new CADability.UserInterface.GeoPointProperty.SelectionChangedDelegate(OnPointsSelectionChanged);
            (vertexProperty as IPropertyEntry).PropertyEntryChangedStateEvent += OnVertexPropertyStateChanged;
            vertexProperty.PrependContextMenue = MenuResource.LoadMenuDefinition("MenuId.Path.Vertex", false, this);

            if (polyline.IsRectangle)
            {
                subEntries       = new IPropertyEntry[2];
                locationProperty = new GeoPointProperty("Rectangle.Location", Frame, true);
                locationProperty.GetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetLocation);
                locationProperty.SetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetLocation);
                locationProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyLocationWithMouse);

                LengthProperty width = new LengthProperty("Rectangle.Width", Frame, true);
                width.GetLengthEvent       += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetWidth);
                width.SetLengthEvent       += new CADability.UserInterface.LengthProperty.SetLengthDelegate(OnSetWidth);
                width.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyWidthWithMouse);
                widthHotSpot                       = new ShowPropertyHotSpot(width, Frame);
                widthHotSpot.Position              = polyline.RectangleLocation + 0.5 * polyline.ParallelogramSecondaryDirection + polyline.ParallelogramMainDirection;
                widthHotSpot.PositionChangedEvent += new CADability.UserInterface.ShowPropertyHotSpot.PositionChangedDelegate(OnWidthPositionChanged);

                LengthProperty height = new LengthProperty("Rectangle.Height", Frame, true);
                height.GetLengthEvent       += new CADability.UserInterface.LengthProperty.GetLengthDelegate(OnGetHeight);
                height.SetLengthEvent       += new CADability.UserInterface.LengthProperty.SetLengthDelegate(OnSetHeight);
                height.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyHeightWithMouse);
                heightHotSpot                       = new ShowPropertyHotSpot(height, Frame);
                heightHotSpot.Position              = polyline.RectangleLocation + polyline.ParallelogramSecondaryDirection + 0.5 * polyline.ParallelogramMainDirection;
                heightHotSpot.PositionChangedEvent += new CADability.UserInterface.ShowPropertyHotSpot.PositionChangedDelegate(OnHeightPositionChanged);

                GeoVectorProperty direction = new GeoVectorProperty("Rectangle.Direction", Frame, true);
                direction.GetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetDirectionX);
                direction.SetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetDirectionX);
                direction.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyDirectionXWithMouse);
                directionHotSpot          = new GeoVectorHotSpot(direction);
                directionHotSpot.Position = polyline.RectangleLocation + polyline.ParallelogramMainDirection;

                sizeHotSpot = new GeoPointHotSpot(polyline.RectangleLocation + polyline.ParallelogramSecondaryDirection + polyline.ParallelogramMainDirection);
                sizeHotSpot.StartDragHotspotEvent += new GeoPointHotSpot.StartDragHotspotDelegate(OnSizeHotSpotStartDragHotspot);

                rectangleProperty = new GroupProperty("Polyline.Rectangle", new IPropertyEntry[] { locationProperty, width, height, direction });
                subEntries[0]     = rectangleProperty;
                (rectangleProperty as IPropertyEntry).PropertyEntryChangedStateEvent += OnRectanglePropertyStateChanged;

                subEntries[1] = vertexProperty;
            }
            else

            if (polyline.IsParallelogram)
            {
                subEntries = new IPropertyEntry[2];
                locationParallelProperty = new GeoPointProperty("Rectangle.Location", Frame, true);
                locationParallelProperty.GetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetParallelLocation);
                locationParallelProperty.SetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetParallelLocation);
                locationParallelProperty.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyLocationWithMouse);

                /*
                 *              LengthProperty widthParallel = new LengthProperty("Rectangle.Width",Frame,true);
                 *              widthParallel.OnGetLength += new Condor.LengthProperty.GetLengthDelegate(OnGetWidthParallel);
                 *              widthParallel.OnSetLength += new Condor.LengthProperty.SetLengthDelegate(OnSetWidthParallel);
                 *              widthParallel.ModifyWithMouse += new ModifyWithMouseDelegate(ModifyWidthWithMouse);
                 *              widthParallelHotSpot = new ShowPropertyHotSpot(widthParallel,Frame);
                 *              widthParallelHotSpot.Position = polyline.ParallelogramLocation+0.5*polyline.ParallelogramSecondaryDirection+polyline.ParallelogramMainDirection;
                 *              widthParallelHotSpot.PositionChanged += new Condor.ShowPropertyHotSpot.PositionChangedDelegate(OnWidthParallelPositionChanged);
                 *
                 *              LengthProperty heightParallel = new LengthProperty("Rectangle.Height",Frame,true);
                 *              heightParallel.OnGetLength += new Condor.LengthProperty.GetLengthDelegate(OnGetHeightParallel);
                 *              heightParallel.OnSetLength += new Condor.LengthProperty.SetLengthDelegate(OnSetHeightParallel);
                 *              heightParallel.ModifyWithMouse += new ModifyWithMouseDelegate(ModifyHeightParallelWithMouse);
                 *              heightParallelHotSpot = new ShowPropertyHotSpot(height,Frame);
                 *              heightParallelHotSpot.Position = polyline.ParallelogramLocation+polyline.ParallelogramSecondaryDirection+0.5*polyline.ParallelogramMainDirection;
                 *              heightParallelHotSpot.PositionChanged += new Condor.ShowPropertyHotSpot.PositionChangedDelegate(OnHeightPositionChanged);
                 *
                 */
                GeoVectorProperty directionXParallel = new GeoVectorProperty("Parallelogram.DirectionX", Frame, true);
                directionXParallel.GetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetDirectionXParallel);
                directionXParallel.SetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetDirectionXParallel);
                directionXParallel.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyDirectionXParallelWithMouse);
                directionXParallelHotSpot          = new GeoVectorHotSpot(directionXParallel);
                directionXParallelHotSpot.Position = polyline.ParallelogramLocation + polyline.ParallelogramMainDirection;

                GeoVectorProperty directionYParallel = new GeoVectorProperty("Parallelogram.DirectionY", Frame, true);
                directionYParallel.GetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.GetGeoVectorDelegate(OnGetDirectionYParallel);
                directionYParallel.SetGeoVectorEvent    += new CADability.UserInterface.GeoVectorProperty.SetGeoVectorDelegate(OnSetDirectionYParallel);
                directionYParallel.ModifyWithMouseEvent += new ModifyWithMouseDelegate(ModifyDirectionXParallelWithMouse);
                directionYParallelHotSpot          = new GeoVectorHotSpot(directionYParallel);
                directionYParallelHotSpot.Position = polyline.ParallelogramLocation + polyline.ParallelogramSecondaryDirection;

                //				parallelProperty = new GroupProperty("Polyline.Parallel", new IPropertyEntry [] {locationParallelProperty,widthParallel,heightParallel,directionParallel});

                sizeHotSpot = new GeoPointHotSpot(polyline.ParallelogramLocation + polyline.ParallelogramSecondaryDirection + polyline.ParallelogramMainDirection);
                sizeHotSpot.StartDragHotspotEvent += new GeoPointHotSpot.StartDragHotspotDelegate(OnSizeHotSpotStartDragHotspot);

                parallelProperty = new GroupProperty("Polyline.Parallel", new IPropertyEntry[] { locationParallelProperty, directionXParallel, directionYParallel });
                subEntries[0]    = parallelProperty;
                (parallelProperty as IPropertyEntry).PropertyEntryChangedStateEvent += OnParallelPropertyStateChanged;

                subEntries[1] = vertexProperty;
            }


            else
            {
                subEntries    = new IPropertyEntry[1];
                subEntries[0] = vertexProperty;
            }
            attributeProperties = polyline.GetAttributeProperties(Frame);
        }