Esempio n. 1
0
/*
 *      public RoofPlane(Coordinate RidgePt1, Coordinate RidgePt2, double RidgeEle, Coordinate EavePt1, Coordinate EavePt2, double EaveEle)
 *      {
 *          this.RidgePt1 = RidgePt1;
 *          this.RidgePt2 = RidgePt2;
 *          this.RidgeEle = RidgeEle;
 *          this.EavePt1 = EavePt1;
 *          this.EavePt2 = EavePt2;
 *          this.EaveEle = EaveEle;
 *          AddEaveLine(EavePt1, EavePt2, EaveEle);
 *          AddRidgeLine(RidgePt1, RidgePt2, RidgeEle);
 *      }
 */
        public RoofPlane(List <Coordinate> RidgeLine, double RidgeEle, List <Coordinate> EaveLine, double EaveEle)
        {
            if (EaveLine.Count >= 2 & RidgeLine.Count >= 2)
            {
                Coordinate p1 = RidgeLine[0];
                Coordinate p2 = RidgeLine[1];
                PvDesktopUtilityFunction util = new PvDesktopUtilityFunction();
                Coordinate[]             site = new Coordinate[5];
                //Darw edge
                double L1, L2;
                L1 = util.Distance(RidgeLine[0], EaveLine[0]);
                L2 = util.Distance(RidgeLine[0], EaveLine[1]);
                if (L1 <= L2)
                {
                    site[0] = RidgeLine[0];
                    site[1] = RidgeLine[1];
                    site[2] = EaveLine[1];
                    site[3] = EaveLine[0];
                    site[4] = RidgeLine[0];
                    AddRidgeLine(RidgeLine[0], RidgeLine[1], RidgeEle);
                    AddEaveLine(EaveLine[0], EaveLine[1], EaveEle);
                }
                else
                {
                    site[0] = RidgeLine[0];
                    site[1] = RidgeLine[1];
                    site[2] = EaveLine[0];
                    site[3] = EaveLine[1];
                    site[4] = RidgeLine[0];
                    AddRidgeLine(RidgeLine[0], RidgeLine[1], RidgeEle);
                    AddEaveLine(EaveLine[1], EaveLine[0], EaveEle);
                }
            }
        }
Esempio n. 2
0
        internal void DrawRoofPland(DotSpatial.Controls.Map pvMap)
        {
            PvDesktopUtilityFunction util = new PvDesktopUtilityFunction();

            util.DrawLine(RidgeLine.Point1, RidgeLine.Point2, 1, Color.Red, pvMap);
            util.DrawLine(RidgeLine.Point2, EaveLine.Point2, 1, Color.Magenta, pvMap);
            util.DrawLine(EaveLine.Point2, EaveLine.Point1, 1, Color.Magenta, pvMap);
            util.DrawLine(EaveLine.Point1, RidgeLine.Point1, 1, Color.Magenta, pvMap);
        }
Esempio n. 3
0
        public List <Coordinate> getPvPointOnRoofPlane(double SpacingX, double SpacingY, double ShiftX, double ShiftY, double roofAngle, double RefEle, bool swith = false)
        {
            List <Coordinate>        mC   = new List <Coordinate>();
            PvDesktopUtilityFunction util = new PvDesktopUtilityFunction();
            double ang = 0;

            if (ridgeLine.Point1.X != ridgeLine.Point2.X)
            {
                ang = Math.Atan((ridgeLine.Point2.Y - ridgeLine.Point1.Y) / (ridgeLine.Point2.X - ridgeLine.Point1.X)) * 180 / Math.PI;
            }
            Coordinate c = getMidRoof();

            Coordinate[] site = new Coordinate[5];
            //Darw edge
            double L1, L2;

            L1 = util.Distance(RidgeLine.Point1, EaveLine.Point1);
            L2 = util.Distance(RidgeLine.Point1, EaveLine.Point2);
            if (L1 <= L2)
            {
                site[0] = new Coordinate(RidgeLine.Point1);
                site[1] = new Coordinate(RidgeLine.Point2);
                site[2] = new Coordinate(EaveLine.Point2);
                site[3] = new Coordinate(EaveLine.Point1);
                site[4] = new Coordinate(RidgeLine.Point1);
            }
            else
            {
                site[0] = new Coordinate(RidgeLine.Point1);
                site[1] = new Coordinate(RidgeLine.Point2);
                site[2] = new Coordinate(EaveLine.Point1);
                site[3] = new Coordinate(EaveLine.Point2);
                site[4] = new Coordinate(RidgeLine.Point1);
            }
            for (int i = 0; i < 5; i++)
            {
                site[i].X -= c.X;
                site[i].Y -= c.Y;
            }



            mC.Clear();
            int    iSwitch = 0;
            double dSwitch = 0;

            for (double y = -50; y <= 50; y += SpacingY)
            {
                for (double x = -50; x <= 50; x += SpacingX)
                {
                    if (swith == false & util.IsOdd(iSwitch))
                    {
                        dSwitch = 0;
                    }
                    else
                    {
                        dSwitch = SpacingX / 2;
                    }
                    double     actualX = x + dSwitch;
                    double     actualY = y * Math.Cos(roofAngle * Math.PI / 180);
                    double     actualZ = RefEle + y * Math.Sin(roofAngle * Math.PI / 180);
                    Coordinate xy      = util.Rotate(actualX + ShiftX, actualY + ShiftY, ang);
                    double     xx      = xy.X;
                    double     yy      = xy.Y;
                    //if (util.PointInPolygon(site, xx, yy) == true)
                    if (IsPointInPolygon(site, xy) == true)
                    {
                        mC.Add(new Coordinate(xx + c.X, yy + c.Y, actualZ));
                    }
                }
                iSwitch++;
            }
            return(mC);
        }