Exemplo n.º 1
0
 public GeneralLengthAction(LengthProperty lengthProperty, GeoPoint linePoint, GeoVector lineDirection, IGeoObject ignoreSnap) : this(lengthProperty, linePoint, lineDirection)
 {
     if (ignoreSnap != null)
     {
         base.IgnoreForSnap = new GeoObjectList(ignoreSnap);
     }
 }
Exemplo n.º 2
0
 public GeneralLengthAction(LengthProperty lengthProperty, GeoPoint linePoint, GeoVector lineDirection)
 {
     this.lengthProperty = lengthProperty;
     this.linePoint      = linePoint;
     this.lineDirection  = lineDirection;
     mode = Mode.fromLine;
 }
Exemplo n.º 3
0
 public GeneralLengthAction(LengthProperty lengthProperty, GeoPoint fixPoint, IGeoObject ignoreSnap) : this(lengthProperty, fixPoint)
 {
     if (ignoreSnap != null)
     {
         base.IgnoreForSnap = new GeoObjectList(ignoreSnap);
     }
 }
Exemplo n.º 4
0
        private void OnPropertySetDistance(LengthProperty sender, double l)
        {
            double oldLineDistance = lineDistance;

            lineDistance = l;
            FireDidChange("LineDistance", oldLineDistance);
        }
Exemplo n.º 5
0
 void OnSetWidth(LengthProperty sender, double l)
 {
     if (l != 0.0)
     {
         picture.SetWidth(l, keepAspectRatio.BooleanValue);
     }
 }
Exemplo n.º 6
0
        private void OnPropertySetMarginOffset(LengthProperty sender, double l)
        {
            double oldMarginOffset = marginOffset;

            marginOffset = l;
            FireDidChange("MarginOffset", oldMarginOffset);
        }
Exemplo n.º 7
0
 public ConstructDistanceOfCurve(LengthProperty lengthProperty)
 {
     this.lengthProperty = lengthProperty;
     if (lengthProperty != null)
     {
         cancelLength = lengthProperty.GetLength();
     }
     measure   = (lengthProperty == null);
     succeeded = false;
 }
Exemplo n.º 8
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;
        }
Exemplo n.º 9
0
 private double OnPropertyGetMarginOffset(LengthProperty sender)
 {
     return(marginOffset);
 }
Exemplo n.º 10
0
 double OnGetHeight(LengthProperty sender)
 {
     return(picture.DirectionHeight.Length);
 }
Exemplo n.º 11
0
 set => SetValue(LengthProperty, value);
Exemplo n.º 12
0
 public ConstructDistanceTwoPoints(LengthProperty lengthProperty)
 {
     this.lengthProperty = lengthProperty;
     measure             = (lengthProperty == null);
     succeeded           = false;
 }
Exemplo n.º 13
0
 get => (double)GetValue(LengthProperty); set => SetValue(LengthProperty, value);
Exemplo n.º 14
0
 public GeneralLengthAction(LengthProperty lengthProperty, GeoPoint fixPoint)
 {
     this.lengthProperty = lengthProperty;
     this.fixPoint       = fixPoint;
     mode = Mode.fromPoint;
 }
Exemplo n.º 15
0
 double OnGetWidth(LengthProperty sender)
 {
     return(picture.DirectionWidth.Length);
 }
Exemplo n.º 16
0
 private double OnPropertyGetDistance(LengthProperty sender)
 {
     return(lineDistance);
 }
Exemplo n.º 17
0
 private void OnSetLength(LengthProperty sender, double l)
 {
     string name = sender.UserData.GetData("Name") as string;
     namedValues[name] = l;
 }
Exemplo n.º 18
0
 private double OnGetLength(LengthProperty sender)
 {
     string name = sender.UserData.GetData("Name") as string;
     return (double)namedValues[name];
 }
Exemplo n.º 19
0
        private Property parsePrimaryExpr()
        {
            Property prop;

            switch (currentToken)
            {
            case TOK_LPAR:
                next();
                prop = parseAdditiveExpr();
                expectRpar();
                return(prop);

            case TOK_LITERAL:
                prop = new StringProperty(currentTokenValue);
                break;

            case TOK_NCNAME:
                prop = new NCnameProperty(currentTokenValue);
                break;

            case TOK_FLOAT:
                prop = new NumberProperty(ParseDouble(currentTokenValue));
                break;

            case TOK_INTEGER:
                prop = new NumberProperty(Int32.Parse(currentTokenValue));
                break;

            case TOK_PERCENT:
                double pcval = ParseDouble(
                    currentTokenValue.Substring(0, currentTokenValue.Length - 1)) / 100.0;
                IPercentBase pcBase = this.propInfo.GetPercentBase();
                if (pcBase != null)
                {
                    if (pcBase.GetDimension() == 0)
                    {
                        prop = new NumberProperty(pcval * pcBase.GetBaseValue());
                    }
                    else if (pcBase.GetDimension() == 1)
                    {
                        prop = new LengthProperty(new PercentLength(pcval,
                                                                    pcBase));
                    }
                    else
                    {
                        throw new PropertyException("Illegal percent dimension value");
                    }
                }
                else
                {
                    prop = new NumberProperty(pcval);
                }
                break;

            case TOK_NUMERIC:
                int    numLen   = currentTokenValue.Length - currentUnitLength;
                string unitPart = currentTokenValue.Substring(numLen);
                double numPart  = ParseDouble(currentTokenValue.Substring(0, numLen));
                Length length   = null;
                if (unitPart.Equals(RELUNIT))
                {
                    length = new FixedLength(numPart, propInfo.currentFontSize());
                }
                else
                {
                    length = new FixedLength(numPart, unitPart);
                }
                if (length == null)
                {
                    throw new PropertyException("unrecognized unit name: " + currentTokenValue);
                }
                else
                {
                    prop = new LengthProperty(length);
                }
                break;

            case TOK_COLORSPEC:
                prop = new ColorTypeProperty(new ColorType(currentTokenValue));
                break;

            case TOK_FUNCTION_LPAR:
            {
                IFunction function =
                    (IFunction)functionTable[currentTokenValue];
                if (function == null)
                {
                    throw new PropertyException("no such function: "
                                                + currentTokenValue);
                }
                next();
                propInfo.pushFunction(function);
                prop = function.Eval(parseArgs(function.NumArgs), propInfo);
                propInfo.popFunction();
                return(prop);
            }

            default:
                throw new PropertyException("syntax error");
            }
            next();
            return(prop);
        }
Exemplo n.º 20
0
        private Property parsePrimaryExpr()
        {
            Property prop;
            switch (currentToken)
            {
                case TOK_LPAR:
                    next();
                    prop = parseAdditiveExpr();
                    expectRpar();
                    return prop;

                case TOK_LITERAL:
                    prop = new StringProperty(currentTokenValue);
                    break;

                case TOK_NCNAME:
                    prop = new NCnameProperty(currentTokenValue);
                    break;

                case TOK_FLOAT:
                    prop = new NumberProperty(ParseDouble(currentTokenValue));
                    break;

                case TOK_INTEGER:
                    prop = new NumberProperty(Int32.Parse(currentTokenValue));
                    break;

                case TOK_PERCENT:
                    double pcval = ParseDouble(
                        currentTokenValue.Substring(0, currentTokenValue.Length - 1)) / 100.0;
                    IPercentBase pcBase = this.propInfo.GetPercentBase();
                    if (pcBase != null)
                    {
                        if (pcBase.GetDimension() == 0)
                        {
                            prop = new NumberProperty(pcval * pcBase.GetBaseValue());
                        }
                        else if (pcBase.GetDimension() == 1)
                        {
                            prop = new LengthProperty(new PercentLength(pcval,
                                                                        pcBase));
                        }
                        else
                        {
                            throw new PropertyException("Illegal percent dimension value");
                        }
                    }
                    else
                    {
                        prop = new NumberProperty(pcval);
                    }
                    break;

                case TOK_NUMERIC:
                    int numLen = currentTokenValue.Length - currentUnitLength;
                    string unitPart = currentTokenValue.Substring(numLen);
                    double numPart = ParseDouble(currentTokenValue.Substring(0, numLen));
                    Length length = null;
                    if (unitPart.Equals(RELUNIT))
                    {
                        length = new FixedLength(numPart, propInfo.currentFontSize());
                    }
                    else
                    {
                        length = new FixedLength(numPart, unitPart);
                    }
                    if (length == null)
                    {
                        throw new PropertyException("unrecognized unit name: " + currentTokenValue);
                    }
                    else
                    {
                        prop = new LengthProperty(length);
                    }
                    break;

                case TOK_COLORSPEC:
                    prop = new ColorTypeProperty(new ColorType(currentTokenValue));
                    break;

                case TOK_FUNCTION_LPAR:
                    {
                        IFunction function =
                            (IFunction)functionTable[currentTokenValue];
                        if (function == null)
                        {
                            throw new PropertyException("no such function: "
                                + currentTokenValue);
                        }
                        next();
                        propInfo.pushFunction(function);
                        prop = function.Eval(parseArgs(function.NumArgs), propInfo);
                        propInfo.popFunction();
                        return prop;
                    }
                default:
                    throw new PropertyException("syntax error");
            }
            next();
            return prop;
        }