예제 #1
0
 public static RTType MakeType(Command c, CGMImage parent)
 {
     RTType type;
     int typ = BinaryUtil.makeIndex(c, parent.IntPrecision);
     switch (typ)
     {
         case 1:
             type = RTType.BASIC;
             break;
         case 2:
             type = RTType.BOXED_CAP;
             break;
         case 3:
             type = RTType.BOXED_ALL;
             break;
         case 4:
             type = RTType.ISOTROPIC_CAP;
             break;
         case 5:
             type = RTType.ISOTROPIC_ALL;
             break;
         case 6:
             type = RTType.JUSTIFIED;
             break;
         default:
             type = RTType.BASIC;
             break;
     }
     return type;
 }
예제 #2
0
        public CGMRestrictedText(Command c, CGMImage parent)
        {
            deltaWidth = BinaryUtil.makeVdc(c, parent.VDCtype, parent.VDCRealType, parent.IntPrecision);
            deltaHeight = BinaryUtil.makeVdc(c, parent.VDCtype, parent.VDCRealType, parent.IntPrecision);
            position = BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.IntPrecision);

            finalNotFinal = BinaryUtil.makeEnum(c);
            Text = BinaryUtil.getString(c);

            type = parent.RestrictedTextType;
        }
예제 #3
0
        public CGMScalingMode(Command c, CGMImage parent)
        {
            int mod = BinaryUtil.makeEnum(c);
            if (mod == 0)
            {
                this.mode = CGMScalingModeMode.ABSTRACT;
            }
            else if (mod == 1)
            {
                this.mode = CGMScalingModeMode.METRIC;
                this.metricScalingFactor = BinaryUtil.makeFloatingPoint(c, parent.RealPrecision);

                // make sure all the arguments were read
                //Debug.Assert((this.currentArg == this.args.length));
            }
        }
예제 #4
0
 public CGMPolyLine(Command c, CGMImage parent)
 {
     points = new List<PointD>();
     int n = c.ParamsLength / BinaryUtil.sizeOfPoint(parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision);
     //p = new System.Drawing.Drawing2D.GraphicsPath();
     PointD lp = new PointD();
     for (int i = 0; i < n; i++)
     {
         PointD point = BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision);
         //if (i == 0)
         //{
         //    //this.path.moveTo(point.x, point.y);
         //}
         //else
         //{
         //    //this.path.lineTo(point.x, point.y);
         //    //p.AddLine((float)lp.x, (float)lp.y,
         //    //    (float)point.x, (float)point.y);
         //}
         points.Add(point);
         lp = point;
     }
 }
예제 #5
0
 public VDCExtent(Command c, CGMImage parent)
 {
     //c.CurrentArg+=3;
     this.lowerLeftCorner = BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.IntPrecision);
     this.upperRightCorner = BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.IntPrecision);
 }
예제 #6
0
 public override Command GetCommand(CGMImage parent)
 {
     throw new NotImplementedException();
 }
예제 #7
0
 public abstract Command GetCommand(CGMImage parent);
예제 #8
0
        public CGMPolyBezier(Command c, CGMImage parent)
        {
            p1 = new List<PointD>();
            p2 = new List<PointD>();
            p3 = new List<PointD>();
            p4 = new List<PointD>();

            this.continuityIndicator = BinaryUtil.makeIndex(c, parent.IntPrecision);

            if (this.continuityIndicator == 1)
            {
                //Debug.Assert(((this.args.length - this.currentArg) / sizeOfPoint()) % 4 == 0);

                int n = ((c.ParamsLength - c.CurrentArg) / BinaryUtil.sizeOfPoint(parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision)) / 4;

                //this.p1 = new Point2D.Double[n];
                //this.p2 = new Point2D.Double[n];
                //this.p3 = new Point2D.Double[n];
                //this.p4 = new Point2D.Double[n];

                int point = 0;
                while (point < n)
                {
                    //this.p1[point] = makePoint();
                    //this.p2[point] = makePoint();
                    //this.p3[point] = makePoint();
                    //this.p4[point] = makePoint();
                    p1.Add(BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision));
                    p2.Add(BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision));
                    p3.Add(BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision));
                    p4.Add(BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision));

                    point++;
                }
            }
            else if (this.continuityIndicator == 2)
            {
                //Debug.Assert(((this.args.length - this.currentArg - 1) / sizeOfPoint()) % 3 == 0);
                //int n = ((this.args.length - this.currentArg - 1) / sizeOfPoint()) / 3;
                int n = ((c.ParamsLength - c.CurrentArg - 1) / BinaryUtil.sizeOfPoint(parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision)) / 3;

                //this.p1 = new Point2D.Double[n];
                //this.p2 = new Point2D.Double[n];
                //this.p3 = new Point2D.Double[n];
                //this.p4 = new Point2D.Double[n];

                int point = 0;
                while (point < n)
                {
                    if (point == 0)
                    {
                        this.p1.Add(BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision));
                    }
                    else
                    {
                        this.p1.Add(this.p4[point - 1]);
                    }
                    p2.Add(BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision));
                    p3.Add(BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision));
                    p4.Add(BinaryUtil.makePoint(c, parent.VDCtype, parent.VDCRealType, parent.VDCIntPrecision));

                    //this.p2[point] = makePoint();
                    //this.p3[point] = makePoint();
                    //this.p4[point] = makePoint();
                    point++;
                }
            }
            //else
            //    unsupported("unsupported continuity indicator " + this.continuityIndicator);
        }
예제 #9
0
 public static int sizeOfVdc(int VDCtype, CGMImage.VDCRealPrecisionType VDCRealPrec, int VDCIntPrec)
 {
     switch (VDCtype)
     {
         case 1://real
             switch (VDCRealPrec)
             {
                 case CGMImage.VDCRealPrecisionType.FLOATING_POINT_32BIT:
                     return sizeOfFloatingPoint32();
                 case CGMImage.VDCRealPrecisionType.FLOATING_POINT_64BIT:
                     return sizeOfFloatingPoint64();
                 case CGMImage.VDCRealPrecisionType.FIXED_POINT_32BIT:
                     return sizeOfFixedPoint32();
                 case CGMImage.VDCRealPrecisionType.FIXED_POINT_64BIT:
                     return sizeOfFixedPoint64();
                 default:
                     break;
             }
             break;
         case 0://int
             return (VDCIntPrec / 8);
         default:
             break;
     }
     return 1;
 }
예제 #10
0
 public static int sizeOfPoint(int VDCtype, CGMImage.VDCRealPrecisionType VDCRealPrec, int VDCIntPrec)
 {
     return 2 * sizeOfVdc(VDCtype, VDCRealPrec, VDCIntPrec);
 }
예제 #11
0
        public static double makeVdc(Command c, int VDCtype, CGMImage.VDCRealPrecisionType RealPrecision, int IntPrecision)
        {
            if (VDCtype == 1)//==real
            {
                if (RealPrecision == CGMImage.VDCRealPrecisionType.FLOATING_POINT_32BIT)
                {
                    return makeFloatingPoint32(c);
                }
                if (RealPrecision == CGMImage.VDCRealPrecisionType.FIXED_POINT_32BIT)
                {
                    return makeFixedPoint32(c);
                }
                if (RealPrecision == CGMImage.VDCRealPrecisionType.FIXED_POINT_64BIT)
                {
                    return makeFixedPoint64(c);
                }

                if (RealPrecision == CGMImage.VDCRealPrecisionType.FLOATING_POINT_64BIT)
                {
                    return makeFloatingPoint64(c);
                }

                //unsupported("unsupported precision " + precision);
                return makeFixedPoint32(c);
            }

            // defaults to integer
            // if (VDCType.getType().equals(VDCType.Type.INTEGER))
            {
                int precision = IntPrecision;
                if (precision == 16)
                {
                    return makeSignedInt16(c);
                }
                if (precision == 24)
                {
                    return makeSignedInt24(c);
                }
                if (precision == 32)
                {
                    return makeSignedInt32(c);
                }

                //unsupported("unsupported precision " + precision);
                return makeSignedInt16(c);
            }
        }
예제 #12
0
 public static PointD makePoint(Command c, int VDCtype, CGMImage.VDCRealPrecisionType RealPrecision, int IntPrecision)
 {
     PointD pf = new PointD(
         makeVdc(c, VDCtype, RealPrecision, IntPrecision),
         makeVdc(c, VDCtype, RealPrecision, IntPrecision)
         );
     return pf;
 }