예제 #1
0
        void OnSizeHotSpotStartDragHotspot(GeoPointHotSpot sender)
        {
            GeneralGeoPointAction gpa = new GeneralGeoPointAction(polyline.ParallelogramLocation + polyline.ParallelogramSecondaryDirection + polyline.ParallelogramMainDirection, polyline);

            gpa.SetGeoPointEvent += new GeneralGeoPointAction.SetGeoPointDelegate(SetSizeGeoPoint);
            Frame.SetAction(gpa);
        }
예제 #2
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);
        }