Beispiel #1
0
        IPolygon pvPanel(double w, double x0, double y0, kGeoFunc.LineType BL)
        {
            BL.Pt2.X = (BL.Pt2.X - BL.Pt1.X);
            BL.Pt2.Y = (BL.Pt2.Y - BL.Pt1.Y);
            BL.Pt1.X = 0;
            BL.Pt1.Y = 0;
            //kGeoFunc.CircleType CL1 = new kGeoFunc.CircleType();
            //kGeoFunc.CircleType CL2 = new kGeoFunc.CircleType();
            kGeoFunc.LineType L1 = kGeoFunc.Perpend2Point(BL, BL.Pt1.X, BL.Pt1.Y, w - 2.5);
            kGeoFunc.LineType L2 = kGeoFunc.Perpend2Point(BL, BL.Pt2.X, BL.Pt2.Y, w - 2.5);
            //int n = kGeoFunc.Line_Circle(L1, CL1, ref x1, ref y1, ref x2, ref y2);
            //int m = kGeoFunc.Line_Circle(L2, CL2, ref x1, ref y1, ref x2, ref y2);
            Coordinate[] Lshape = new Coordinate[5]; //x-axis

            Lshape[0] = new Coordinate(BL.Pt1.X + x0, BL.Pt1.Y + y0);
            Lshape[1] = new Coordinate(L1.Pt1.X + x0, L1.Pt1.Y + y0);
            Lshape[2] = new Coordinate(L2.Pt1.X + x0, L2.Pt1.Y + y0);
            Lshape[3] = new Coordinate(BL.Pt2.X + x0, BL.Pt2.Y + y0);
            Lshape[4] = new Coordinate(BL.Pt1.X + x0, BL.Pt1.Y + y0);

            // Polygon Featture
            //creates a polygon feature from the list of coordinate
            IPolygon fe = new Polygon(Lshape);

            // Line Feature
            //LineString ls = new LineString(Lshape); //  for line shape
            //creates a feature from the linestring
            // fe = new Polygon(ls); // for line shape

            return(fe);
        }
Beispiel #2
0
        private void cmdDrawPv_Click(object sender, EventArgs e)
        {
            kGeoFunc.LineType   BL = new kGeoFunc.LineType();
            kGeoFunc.LineType   dL = new kGeoFunc.LineType();
            kGeoFunc.CircleType CL = new kGeoFunc.CircleType();
            double dx = 10.0; //m.
            //  Feature f = new Feature(axisLines);
            IFeatureSet fs;   //= new FeatureSet(FeatureType.Line);

            fs = new FeatureSet(FeatureType.Polygon);

            /*
             * for (int n = 0; n < grdBaselineLayout.Rows.Count - 2; n++)
             * {
             *   BL.Pt1.X = (double)this.grdBaselineLayout.Rows[n].Cells[1].Value;
             *   BL.Pt1.Y = (double)this.grdBaselineLayout.Rows[n].Cells[2].Value;
             *   BL.Pt2.X = (double)this.grdBaselineLayout.Rows[n+1].Cells[1].Value;
             *   BL.Pt2.Y = (double)this.grdBaselineLayout.Rows[n+1].Cells[2].Value;
             *   double L = kGeoFunc.Length(BL);
             *   //DrawLine(BL.Pt1.X, BL.Pt1.Y, BL.Pt2.X, BL.Pt2.Y, 3, System.Drawing.Color.Magenta);
             *
             *   for (double r = dx; r < L-dx/2; r += dx)
             *   {
             *       //Todo: add PV array
             *       CL.pt.X = BL.Pt1.X;
             *       CL.pt.Y = BL.Pt1.Y;
             *       CL.R = r;
             *       double x1 = 0; double y1 = 0;
             *       double x2 = 0; double y2 = 0;
             *       //dL.Pt1.X = BL.Pt1.X;
             *       double xt1 = 0; double yt1 = 0;
             *       double xt2 = 0; double yt2 = 0;
             *       double xt3 = 0; double yt3 = 0;
             *       double xt4 = 0; double yt4 = 0;
             *       //dL.Pt1.Y = BL.Pt1.Y;
             *       CL.R = r - (dx / 2 - 0.5);
             *       int mm = kGeoFunc.Line_Circle(BL, CL, ref xt1, ref yt1, ref xt2, ref yt2);
             *       CL.R = r + (dx / 2 - 0.5);
             *       int nn = kGeoFunc.Line_Circle(BL, CL, ref xt3, ref yt3, ref xt4, ref yt4);
             *       //---------------------------------------------------
             *       dL.Pt1.X = xt1;
             *       dL.Pt1.Y = yt1;
             *       dL.Pt2.X = xt3;
             *       dL.Pt2.Y = yt3;
             *       //---------------------------------------------------
             *
             *       CL.R = r;
             *       if (kGeoFunc.Line_Circle(BL, CL, ref x1, ref y1, ref x2, ref y2) >= 1)
             *       {
             *           kGeoFunc.POINTAPI pt1;
             *           kGeoFunc.POINTAPI pt2;
             *           pt1.X = x1;
             *           pt1.Y = y1;
             *           pt2.X = x2;
             *           pt2.Y = y2;
             *           double dy = 60.0;
             *           kGeoFunc.LineType Lt =kGeoFunc.Perpend2Point(BL, x1, y1, dy);
             *           //Todo: add PV array
             *           kGeoFunc.CircleType CLL = new kGeoFunc.CircleType();
             *           CLL.pt.X = Lt.Pt1.X;
             *           CLL.pt.Y = Lt.Pt1.Y;
             *           double w = 25;
             *           for (double r2 = 0; r2 <= dy; r2 += w)
             *           {
             *               CLL.R = r2;
             *               if (kGeoFunc.Line_Circle(Lt, CLL, ref x1, ref y1, ref x2, ref y2) >= 1)
             *               {
             *                   fs.Features.Add(pvPanel(w, x1, y1, dL));
             *               }
             *           }
             *           //---------------------------------------------------
             *           //DrawLine(Lt.Pt1.X, Lt.Pt1.Y, Lt.Pt2.X, Lt.Pt2.Y, 1, System.Drawing.Color.Red);
             *           //Coordinate[] Lshape = new Coordinate[2]; //x-axis
             *           //x1 = Lt.Pt1.X;
             *           //y1 = Lt.Pt1.Y;
             *           //x2 = Lt.Pt1.X;
             *           //y2 = Lt.Pt1.Y;
             *           //Lshape[0] = new Coordinate(x1, y1);
             *           //Lshape[1] = new Coordinate(x2, y2);
             *
             *           //LineString ls = new LineString(Lshape);
             *           //creates a feature from the linestring
             *           // Feature f = new Feature(ls);
             *           // fs.Features.Add(f);
             *       }
             *
             *   }
             * }
             */
            fs.Projection = pvMap4Draw.Projection;
            //MessageBox.Show(fea.ToString);
            fs.Name = "pv Array";
            //pvMap4Draw.Layers.Add(fs);
            fs.SaveAs("..\\pvArray.shp", true);
            pvMap4Draw.MapFrame.DrawingLayers.Clear();
            MapPolygonLayer rangeRingAxis;

            rangeRingAxis = new MapPolygonLayer(fs);// MapPolygonLayer(fs);
            //rangeRingAxis.Symbolizer = new PolygonSymbolizer(System.Drawing.Color.AliceBlue, System.Drawing.Color.LightBlue);
            pvMap4Draw.MapFrame.DrawingLayers.Add(rangeRingAxis);
            pvMap4Draw.MapFrame.Invalidate();
        }