Пример #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="cptlt"></param>
        /// <param name="pEnvelopeLayer"></param>
        /// <param name="pEnvelopeIpe"></param>
        /// <param name="dblFactor"></param>
        /// <param name="intSubtract">In ipe, the first vertex and the last vertex are not identical.
        /// Therefore, 0 if shape is polyline, 1 if shape is polygon</param>
        /// <returns></returns>
        /// <remarks>
        ///*********************polyline*****************************
        ///<path stroke="1 0.643 0.161" pen="fat">
        ///96 192 m
        ///160 144 l
        ///208 224 l
        ///</path>
        ///*********************multi polylines*****************************
        ///<path stroke="0 1 0.161" pen="fat">
        ///96 96 m
        ///112 32 l
        ///176 48 l
        ///208 112 l
        ///256 80 m
        ///256 32 l
        ///304 32 l
        ///336 80 l
        ///</path>
        ///*********************polygon******************************************
        ///<path stroke="1 0.643 0.208" fill="0.212 0.388 0.047" pen="fat">
        ///400 224 m
        ///352 128 l
        ///448 80 l
        ///544 192 l
        ///h
        ///</path>
        ///*********************polygon with two holes*********************
        ///<path stroke="1 0.2 0.502" fill="0.094 1 0" pen="fat">
        ///400 224 m
        ///352 128 l
        ///448 80 l
        ///544 192 l
        ///h
        ///416 176 m
        ///384 160 l
        ///416 128 l
        ///h
        ///448 192 m
        ///448 144 l
        ///496 176 l
        ///h
        ///</path>
        /// </remarks>
        public static string AddCoordinates(List <CPoint> cptlt, IEnvelope pEnvelopeLayer,
                                            CEnvelope pEnvelopeIpe, double dblFactor, int intSubtract = 0)
        {
            int intRealCount = cptlt.Count - intSubtract;

            double[] dblx = new double[intRealCount];
            double[] dbly = new double[intRealCount];

            for (int i = 0; i < intRealCount; i++)
            {
                dblx[i] = CGeoFunc.CoordinateTransform(
                    cptlt[i].X, pEnvelopeLayer.XMin, pEnvelopeIpe.XMin, dblFactor);
                dbly[i] = CGeoFunc.CoordinateTransform(
                    cptlt[i].Y, pEnvelopeLayer.YMin, pEnvelopeIpe.YMin, dblFactor);
            }

            string str = AddXY(dblx[0], dbly[0]) + " m\n";

            for (int j = 1; j < dblx.Length; j++)
            {
                str += AddXY(dblx[j], dbly[j]) + " l\n";
            }

            return(str);
        }
Пример #2
0
        public static string DrawIpt(IPoint ipt, IEnvelope pEnvelopeLayer, CEnvelope pEnvelopeIpe, string strShape,
                                     CColor StrokeColor, string strWidth = "normal")
        {
            double dblFactor = pEnvelopeIpe.Height / pEnvelopeLayer.Height;
            double dblx      = CGeoFunc.CoordinateTransform(
                ipt.X, pEnvelopeLayer.XMin, pEnvelopeIpe.XMin, dblFactor);
            double dbly = CGeoFunc.CoordinateTransform(
                ipt.Y, pEnvelopeLayer.YMin, pEnvelopeIpe.YMin, dblFactor);

            return(drawIpeMark(dblx, dbly, strShape, AddColor(StrokeColor), strWidth));
        }
Пример #3
0
        public static string DrawCpl(CPolyline cpl, IEnvelope pEnvelopeLayer, CEnvelope pEnvelopeIpe,
                                     CColor StrokeColor, string strWidth = "normal")
        {
            double dblFactor = pEnvelopeIpe.Height / pEnvelopeLayer.Height;

            var cptlt = cpl.CptLt;

            string str = GetStrokeStarting(StrokeColor, strWidth, "normal", "1", "1", null);

            str += AddCoordinates(cptlt, pEnvelopeLayer, pEnvelopeIpe, dblFactor);
            str += "</path>\n";

            return(str);
        }
Пример #4
0
        public static string DrawCpgBound(CPolygon cpg, IEnvelope pEnvelopeLayer, CEnvelope pEnvelopeIpe,
                                          CColor StrokeColor, string strWidth = "normal", string strDash = "normal")
        {
            double dblFactor = pEnvelopeIpe.Height / pEnvelopeLayer.Height;
            string str       = GetStrokeStarting(StrokeColor, strWidth, strDash, "1", "1");

            str += AddCoordinates(cpg.CptLt, pEnvelopeLayer, pEnvelopeIpe, dblFactor);

            //draw holes and fill wholes with white
            if (cpg.HoleCpgLt != null && cpg.HoleCpgLt.Count > 0)
            {
                foreach (var holecpg in cpg.HoleCpgLt)
                {
                    str += AddCoordinates(holecpg.CptLt, pEnvelopeLayer, pEnvelopeIpe, dblFactor);
                    if (holecpg.HoleCpgLt != null && holecpg.HoleCpgLt.Count > 0)
                    {
                        throw new ArgumentOutOfRangeException("We didn't consider this case!");
                    }
                }
            }

            str += "</path>\n";
            return(str);
        }
Пример #5
0
 private static string AddPolygonCoordinates(List <CPoint> cptlt, IEnvelope pEnvelopeLayer,
                                             CEnvelope pEnvelopeIpe, double dblFactor)
 {
     return(AddCoordinates(cptlt, pEnvelopeLayer, pEnvelopeIpe, dblFactor, 1) + "h\n");
 }