Exemple #1
0
        public override IPropertyEntry GetPropertyEntry(IFrame frame)
        {
            List <IPropertyEntry> se       = new List <IPropertyEntry>();
            GeoPointProperty      location = new GeoPointProperty(frame, "PlanarSurface.Location");

            location.ReadOnly   = true;
            location.OnGetValue = new EditableProperty <GeoPoint> .GetValueDelegate(delegate() { return(fromUnitPlane *GeoPoint.Origin); });

            se.Add(location);
            GeoVectorProperty dirx = new GeoVectorProperty(frame, "PlanarSurface.DirectionX");

            dirx.ReadOnly   = true;
            dirx.IsAngle    = false;
            dirx.OnGetValue = new EditableProperty <GeoVector> .GetValueDelegate(delegate() { return(fromUnitPlane *GeoVector.XAxis); });

            se.Add(dirx);
            GeoVectorProperty diry = new GeoVectorProperty(frame, "PlanarSurface.DirectionY");

            diry.ReadOnly   = true;
            diry.IsAngle    = false;
            diry.OnGetValue = new EditableProperty <GeoVector> .GetValueDelegate(delegate() { return(fromUnitPlane *GeoVector.YAxis); });

            se.Add(diry);
            return(new GroupProperty("PlanarSurface", se.ToArray()));
        }
 public GeneralGeoVectorAction(GeoVectorProperty ToModify, GeoPoint basePoint, IGeoObject ignoreSnap) : this(ToModify, basePoint)
 {
     if (ignoreSnap != null)
     {
         base.IgnoreForSnap = new GeoObjectList(ignoreSnap);
     }
 }
        public override IPropertyEntry GetPropertyEntry(IFrame frame)
        {
            List <IPropertyEntry> se       = new List <IPropertyEntry>();
            GeoPointProperty      location = new GeoPointProperty("ConicalSurface.Location", frame, false);

            location.ReadOnly          = true;
            location.GetGeoPointEvent += delegate(GeoPointProperty sender) { return(this.location); };
            se.Add(location);
            GeoVectorProperty dirx = new GeoVectorProperty("ConicalSurface.DirectionX", frame, false);

            dirx.ReadOnly           = true;
            dirx.IsAngle            = false;
            dirx.GetGeoVectorEvent += delegate(GeoVectorProperty sender) { return(xAxis); };
            se.Add(dirx);
            GeoVectorProperty diry = new GeoVectorProperty("ConicalSurface.DirectionY", frame, false);

            diry.ReadOnly           = true;
            diry.IsAngle            = false;
            diry.GetGeoVectorEvent += delegate(GeoVectorProperty sender) { return(yAxis); };
            se.Add(diry);
            AngleProperty openingAngle = new AngleProperty("ConicalSurface.OpeningAngle", frame, false);

            openingAngle.ReadOnly       = true;
            openingAngle.GetAngleEvent += delegate() { return(OpeningAngle); };
            se.Add(openingAngle);
            return(new GroupProperty("ConicalSurface", se.ToArray()));
        }
Exemple #4
0
 public ConstructDirectionOfCurve(GeoVectorProperty vectorProperty)
 {
     this.vectorProperty = vectorProperty;
     if (vectorProperty != null)
     {
         cancelVector = vectorProperty.GetGeoVector();
     }
     measure   = (vectorProperty == null);
     succeeded = false;
 }
Exemple #5
0
        void OnSetDirWidth(GeoVectorProperty sender, GeoVector v)
        {
            double    l      = picture.DirectionWidth.Length;
            GeoVector normal = picture.DirectionWidth ^ picture.DirectionHeight;

            using (base.Frame.Project.Undo.UndoFrame)
            {
                picture.DirectionWidth = l * v.Normalized;
                if (rectangular.BooleanValue)
                {
                    picture.DirectionHeight = picture.DirectionHeight.Length * (normal ^ v).Normalized;
                }
                if (keepAspectRatio.BooleanValue)
                {
                    picture.DirectionHeight = picture.DirectionWidth.Length * picture.Bitmap.Height / picture.Bitmap.Width * picture.DirectionHeight.Normalized;
                }
            }
        }
Exemple #6
0
        private GeoVectorHotSpot dirWidthHotSpot, dirHeightHotSpot; // Hotspot für Richtung

        public ShowPropertyPicture(Picture picture, IFrame Frame) : base(Frame)
        {
            this.picture        = picture;
            attributeProperties = picture.GetAttributeProperties(Frame);
            base.resourceId     = "Picture.Object";

            location = new GeoPointProperty("Picture.Location", Frame, true);
            location.GetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.GetGeoPointDelegate(OnGetRefPoint);
            location.SetGeoPointEvent     += new CADability.UserInterface.GeoPointProperty.SetGeoPointDelegate(OnSetRefPoint);
            location.ModifyWithMouseEvent += new ModifyWithMouseDelegate(OnModifyLocationWithMouse);
            width = new LengthProperty("Picture.Width", Frame, true);
            width.GetLengthEvent += new LengthProperty.GetLengthDelegate(OnGetWidth);
            width.SetLengthEvent += new LengthProperty.SetLengthDelegate(OnSetWidth);
            height = new LengthProperty("Picture.Height", Frame, true);
            height.GetLengthEvent += new LengthProperty.GetLengthDelegate(OnGetHeight);
            height.SetLengthEvent += new LengthProperty.SetLengthDelegate(OnSetHeight);
            dirWidth = new GeoVectorProperty("Picture.DirWidth", Frame, true);
            dirWidth.GetGeoVectorEvent    += new GeoVectorProperty.GetGeoVectorDelegate(OnGetDirWidth);
            dirWidth.SetGeoVectorEvent    += new GeoVectorProperty.SetGeoVectorDelegate(OnSetDirWidth);
            dirWidth.ModifyWithMouseEvent += new ModifyWithMouseDelegate(OnModifyDirWidthWithMouse);
            dirHeight = new GeoVectorProperty("Picture.DirHeight", Frame, true);
            dirHeight.GetGeoVectorEvent    += new GeoVectorProperty.GetGeoVectorDelegate(OnGetDirHeight);
            dirHeight.SetGeoVectorEvent    += new GeoVectorProperty.SetGeoVectorDelegate(OnSetDirHeight);
            dirHeight.ModifyWithMouseEvent += new ModifyWithMouseDelegate(OnModifyDirHeightWithMouse);
            path = new StringProperty(picture.Path, "Picture.Path");
            path.GetStringEvent += new StringProperty.GetStringDelegate(OnGetPath);
            path.SetStringEvent += new StringProperty.SetStringDelegate(OnSetPath);
            path.SetContextMenu("MenuId.Picture.Path", this);
            keepAspectRatio = new BooleanProperty("Picture.KeepAspectRatio", "YesNo.Values");
            double p = picture.DirectionWidth.Length / picture.Bitmap.Width * picture.Bitmap.Height / picture.DirectionHeight.Length;

            keepAspectRatio.BooleanValue         = Math.Abs(1.0 - p) < 1e-6;
            keepAspectRatio.BooleanChangedEvent += new BooleanChangedDelegate(OnKeepAspectRatioChanged);
            rectangular = new BooleanProperty("Picture.Rectangular", "YesNo.Values");
            rectangular.BooleanValue         = Precision.IsPerpendicular(picture.DirectionWidth, picture.DirectionHeight, false);
            rectangular.BooleanChangedEvent += new BooleanChangedDelegate(OnRectangularChanged);
            dirWidthHotSpot           = new GeoVectorHotSpot(dirWidth);
            dirWidthHotSpot.Position  = picture.Location + picture.DirectionWidth;
            dirHeightHotSpot          = new GeoVectorHotSpot(dirHeight);
            dirHeightHotSpot.Position = picture.Location + picture.DirectionHeight;
        }
Exemple #7
0
 private void OnSetProjectionDirection(GeoVectorProperty sender, GeoVector v)
 {
     if (Precision.SameDirection(v, GeoVector.ZAxis, false))
     {
         Projection.SetDirection(v, GeoVector.YAxis, model.Extent);
     }
     else
     {   // Richtung setzen unter Beibehaltung der Rochtung der Z-Achse (vorausgesetzt sie ist senkrecht, sonst macht es keinen Sinn)
         GeoVector2D updown = Projection.Project2D(new GeoPoint(0, 0, 1)) - Projection.Project2D(GeoPoint.Origin);
         if (updown.y <= 0)
         {
             Projection.SetDirection(v, new GeoVector(0.0, 0.0, 1.0), model.Extent);
         }
         else
         {
             Projection.SetDirection(v, new GeoVector(0.0, 0.0, -1.0), model.Extent);
         }
         // Projection.SetDirection(v, GeoVector.ZAxis, model.Extent);
     }
     layoutView.Repaint();
 }
Exemple #8
0
 GeoVector OnGetDirWidth(GeoVectorProperty sender)
 {
     return(picture.DirectionWidth);
 }
Exemple #9
0
 GeoVector OnGetDirHeight(GeoVectorProperty sender)
 {
     return(picture.DirectionHeight);
 }
 /// <summary>
 /// Constructs a GeneralGeoVectorAction to modify the provided <see cref="GeoVectorProperty"/>
 /// </summary>
 /// <param name="ToModify">Property to modify</param>
 /// <param name="basePoint">A basePoint for the modification</param>
 public GeneralGeoVectorAction(GeoVectorProperty ToModify, GeoPoint basePoint)
 {
     this.geoVectorProperty = ToModify;
     initialGeoVectorValue  = ToModify.GetGeoVector();
     this.basePoint         = basePoint;
 }
Exemple #11
0
 private GeoVector OnGetProjectionDirection(GeoVectorProperty sender)
 {
     return(Projection.Direction);
 }
Exemple #12
0
        void FilterCommandProjectionDirection(GeoVectorProperty sender, string menuId, CommandState commandState, ref bool handled)
        {
            GeoVector viewDirection         = sender.GetGeoVector();
            bool      viewDirectionModified = false;

            if (commandState != null)
            {
                switch (menuId)
                {
                case "MenuId.Projection.Direction.FromTop":
                    commandState.Checked = Precision.SameNotOppositeDirection(Projection.Direction, -GeoVector.ZAxis);
                    break;

                case "MenuId.Projection.Direction.FromFront":
                    commandState.Checked = Precision.SameNotOppositeDirection(Projection.Direction, GeoVector.YAxis);
                    break;

                case "MenuId.Projection.Direction.FromBack":
                    commandState.Checked = Precision.SameNotOppositeDirection(Projection.Direction, -GeoVector.YAxis);
                    break;

                case "MenuId.Projection.Direction.FromLeft":
                    commandState.Checked = Precision.SameNotOppositeDirection(Projection.Direction, GeoVector.XAxis);
                    break;

                case "MenuId.Projection.Direction.FromRight":
                    commandState.Checked = Precision.SameNotOppositeDirection(Projection.Direction, -GeoVector.XAxis);
                    break;

                case "MenuId.Projection.Direction.FromBottom":
                    commandState.Checked = Precision.SameNotOppositeDirection(Projection.Direction, GeoVector.ZAxis);
                    break;

                case "MenuId.Projection.Direction.Isometric":
                    GeoVector vd = new GeoVector(-1, -1, -1);
                    vd.Norm();
                    commandState.Checked = Precision.SameNotOppositeDirection(Projection.Direction, vd);
                    break;

                case "MenuId.Projection.Direction.Perspective":
                    commandState.Enabled = false;
                    break;
                }
            }
            else
            {
                switch (menuId)
                {
                case "MenuId.Projection.Direction.FromTop":
                    Projection.SetDirection(-GeoVector.ZAxis, GeoVector.YAxis, model.Extent);
                    viewDirectionModified = true;
                    handled = true;
                    break;

                case "MenuId.Projection.Direction.FromFront":
                    Projection.SetDirection(GeoVector.YAxis, GeoVector.ZAxis, model.Extent);
                    viewDirectionModified = true;
                    handled = true;
                    break;

                case "MenuId.Projection.Direction.FromBack":
                    Projection.SetDirection(-GeoVector.YAxis, GeoVector.ZAxis, model.Extent);
                    viewDirectionModified = true;
                    handled = true;
                    break;

                case "MenuId.Projection.Direction.FromLeft":
                    Projection.SetDirection(GeoVector.XAxis, GeoVector.ZAxis, model.Extent);
                    viewDirectionModified = true;
                    handled = true;
                    break;

                case "MenuId.Projection.Direction.FromRight":
                    Projection.SetDirection(-GeoVector.XAxis, GeoVector.ZAxis, model.Extent);
                    viewDirectionModified = true;
                    handled = true;
                    break;

                case "MenuId.Projection.Direction.FromBottom":
                    Projection.SetDirection(GeoVector.ZAxis, GeoVector.YAxis, model.Extent);
                    viewDirectionModified = true;
                    handled = true;
                    break;

                case "MenuId.Projection.Direction.Isometric":
                    GeoVector vd = new GeoVector(-1, -1, -1);
                    vd.Norm();
                    Projection.SetDirection(vd, GeoVector.YAxis, model.Extent);
                    viewDirectionModified = true;
                    handled = true;
                    break;
                }
                if (viewDirectionModified)
                {
                    OnSetProjectionDirection(sender, Projection.Direction);
                    propertyTreeView.SelectEntry(projectionDirection);
                    projectionDirection.Refresh();
                }
            }
        }
 private void OnSetGeoVector(GeoVectorProperty sender, GeoVector v)
 {
     string name = sender.UserData.GetData("Name") as string;
     namedValues[name] = v;
 }
 private GeoVector OnGetGeoVector(GeoVectorProperty sender)
 {
     string name = sender.UserData.GetData("Name") as string;
     return (GeoVector)namedValues[name];
 }
Exemple #15
0
 public ConstructDirectionTwoPoints(GeoVectorProperty vectorProperty)
 {
     this.vectorProperty = vectorProperty;
     measure             = (vectorProperty == null);
     succeeded           = false;
 }