Esempio n. 1
0
 public void basic_ranagebox_render()
 {
     var html = new RangeBox("foo").ToString();
     html.ShouldHaveHtmlNode("foo")
         .ShouldBeNamed(HtmlTag.Input)
         .ShouldHaveAttribute(HtmlAttribute.Type).WithValue(HtmlInputType.Range);
 }
Esempio n. 2
0
        public SpellForm(XmlNode node)
        {
            InitializeComponent();



            #region

            RangeBox.BeginUpdate();
            RangeBox.Items.Clear();
            foreach (string name in Enum.GetNames(typeof(SpellRange)))
            {
                RangeBox.Items.Add(name);
            }
            RangeBox.EndUpdate();
            #endregion



            Spell spell = new Spell();
            spell.Load(node);

            RangeBox.SelectedItem = spell.Range.ToString();
            DescriptionBox.Text   = spell.Description;
            DurationBox.Value     = (int)spell.Duration.TotalSeconds;
            CastingTimeBox.Value  = (int)spell.CastingTime.TotalSeconds;
            LevelBox.Value        = (int)spell.Level;
            ScriptBox.SetValues <ISpell>(spell.Script);
            ClassBox.SelectedItem = spell.Class.ToString();

            Spell = spell;
        }
Esempio n. 3
0
        public void rangebox_list_renders_list()
        {
            var html = new RangeBox("foo").List("list1").ToString();

            html.ShouldHaveHtmlNode("foo")
            .ShouldHaveAttribute(HtmlAttribute.List).WithValue("list1");
        }
Esempio n. 4
0
        public void basic_ranagebox_render()
        {
            var html = new RangeBox("foo").ToString();

            html.ShouldHaveHtmlNode("foo")
            .ShouldBeNamed(HtmlTag.Input)
            .ShouldHaveAttribute(HtmlAttribute.Type).WithValue(HtmlInputType.Range);
        }
Esempio n. 5
0
 public void rangebox_list_renders_list()
 {
     var html = new RangeBox("foo").List("list1").ToString();
     html.ShouldHaveHtmlNode("foo")
         .ShouldHaveAttribute(HtmlAttribute.List).WithValue("list1");
 }
        private void ProcessMainObjects(ReadOnlyCollection <BusinessObject> oBOCObjects, FilterBase oUniqueCheckFilter)
        {
            foreach (var oObj in oBOCObjects)
            {
                foreach (var MainObject in _oSetting.InfoForReferenceObjectRules.MainObjectsInterface.Split('|').Select(x => x.Trim())) //Mainobject in XML
                {
                    if (!oObj.SupportsInterface(MainObject.ToString()))                                                                 //If not contains, Interface of Mainobject (Stair or Slab)
                    {
                        continue;
                    }
                    if (oObj is Stair && oObj.GetPropertyValue("IJNamedItem", "Name").ToString().Contains("Stair")) //Stair
                    {
                        var           oStair              = oObj as Stair;                                          //Stair Object
                        Matrix4X4     oMat                = new Matrix4X4(oStair.Matrix);                           // StairMatrix (Global Axis -> Local Axis)
                        Vector        rotateVec           = oMat.XAxis;                                             //X Axis of StairMatrix : Rotate base on X Axis
                        IMathServices oMathService        = new Math3d();
                        Collection <BusinessObject> oColl = new Collection <BusinessObject>()
                        {
                            oStair
                        };

                        var      oRange = (oStair as IRange).Range;
                        double   dRadian = (oStair.GetPropertyValue("IJSPSCommonStairLadderProps", "Angle") as PropertyValueDouble).PropValue.Value; //Stair Angle
                        double   height = MiddleServiceProvider.UOMMgr.ParseUnit(UnitType.Distance, _oSetting.Clearance.Value);                      //Height of user set
                        Position posSrc, posSrc2;
                        double   dMinDist;

                        oMat.Rotate(dRadian, rotateVec);                                                                      //Based on X Axis of Stair, Matrix will rotate by Angle
                        OrientedRangeBox oOrientedRangeBox = oMathService.GetOrientedRangeBox(oColl, oMat.XAxis, oMat.YAxis); //Oriented Range Box of Stair

                        //OriginXYZ <-> Y Axis Near surface minDistance and Position on surface
                        oRange.GetFaceInGivenDirection(oMat.YAxis, true).DistanceBetween(new Point3d(oOrientedRangeBox.Origin.X,
                                                                                                     oOrientedRangeBox.Origin.Y,
                                                                                                     oOrientedRangeBox.Origin.Z), out dMinDist, out posSrc);
                        //OriginXYZ <-> Y Axis Far surface minDIstance and Position on surface
                        oRange.GetFaceInGivenDirection(oMat.YAxis, false).DistanceBetween(new Point3d(oOrientedRangeBox.Origin.X,
                                                                                                      oOrientedRangeBox.Origin.Y,
                                                                                                      oOrientedRangeBox.Origin.Z), out dMinDist, out posSrc2);

                        double dJustMinDist = posSrc.DistanceToPoint(posSrc2);        //posSrc <-> posSrc2 Distance
                        double c            = dJustMinDist / Math.Cos(dRadian);       //Distance / cos  = length of sloped stair
                        Vector oTanVector   = new Vector(oOrientedRangeBox.Sides[1]); //Tangent Vector of Oriented Range Box (Y Axis)
                        oTanVector.Length = c;
                        Position corner1 = new Position(posSrc);
                        Position corner2 = new Position(posSrc).Offset(oOrientedRangeBox.Sides[0]);
                        Position corner3 = new Position(posSrc).Offset(oOrientedRangeBox.Sides[0]).Offset(oTanVector);
                        Position corner4 = new Position(posSrc.Offset(oTanVector));
                        //Corners of stair

                        double dPostHeight = MiddleServiceProvider.UOMMgr.ParseUnit(UnitType.Distance, oStair.GetPropertyValue("IJUAStairTypeA", "PostHeight").ToString());
                        double dTopElev    = Math.Max(Math.Max(corner1.Z, corner2.Z),
                                                      Math.Max(corner3.Z, corner4.Z));                                              //Maximum elevation of bottom of stair
                        double dHeight = (oRange.High.Z - dTopElev);                                                                // Top point of Handrail - bottom Elevation of Stair = Stair Height
                        corner1.Z += dHeight; corner2.Z += dHeight; corner3.Z += dHeight; corner4.Z += dHeight;                     // + Stair Height

                        Vector uVec = corner2.Subtract(corner1);                                                                    //UVector of Symbol
                        Vector vVec = corner3.Subtract(corner2);                                                                    //Vvector of Symbol
                        //uVec.Length=1.0; vVec.Length=1.0;
                        OrientedRangeBox oOrientedRBHC = new OrientedRangeBox(new Position(corner1),                                // Creates Oritented RangeBox of Head Clearance
                                                                              uVec, vVec, new Vector(0, 0, height - dHeight));      //2.0m - Stair height = RBHC RangeBox
                        RangeBox oExtendedRange = new RangeBox(new Position(oRange.Low),
                                                               new Position(oRange.High.X, oRange.High.Y, oRange.High.Z + height)); // 2.0m is height value adjustable

                        string    subSelectQueryCriteria = GenericUtils.GetSQLQueryBasedOnObjectTypeViewCriteria("JDObject");
                        string    sqlQuery = GenericUtils.GetSQLQueryForObjectsOverlappingRangeBox(oExtendedRange, subSelectQueryCriteria);
                        SQLFilter oFilter  = new SQLFilter();
                        oFilter.SetSQLFilterString(sqlQuery);
                        ReadOnlyCollection <BusinessObject> oReadOnlyColl = oFilter.Apply(MiddleServiceProvider.SiteMgr.ActiveSite.ActivePlant.PlantModel);
                        //SQLFilter for Searching Overlapping Object

                        //Highlight object
                        GraphicViewHiliter oHiliter = new GraphicViewHiliter();
                        oHiliter.Weight      = 5;
                        oHiliter.Color       = ColorConstants.RGBYellow;
                        oHiliter.LinePattern = HiliterBase.HiliterLinePattern.Dotted;
                        Hiliter oHiliter2 = new Hiliter();
                        oHiliter2.Weight = 10;
                        oHiliter2.Color  = ColorConstants.RGBBlue;
                        Hiliter oHiliter3 = new Hiliter();
                        oHiliter3.Weight = 3;
                        oHiliter3.Color  = ColorConstants.RGBWhite;
                        Dictionary <string, List <BusinessObject> > oDic = new Dictionary <string, List <BusinessObject> >();
                        oDic["Overlap"] = new List <BusinessObject>();
                        oDic["Inside"]  = new List <BusinessObject>();
                        ClientServiceProvider.SelectSet.SelectedObjects.Clear();

                        List <BusinessObject> refObjList = new List <BusinessObject>(); //BusinessObject List
                        List <String>         stringList = new List <String>();         //oid LIst

                        foreach (var oObject in oReadOnlyColl)
                        {
                            if (!IsSupportInerface(oObject))
                            {
                                refObjList.Add(oObject);
                                stringList.Add(oObject.ObjectID);
                            }
                            else
                            {
                                continue;
                            }

                            OrientedRangeBox oObjectOrientedBox = oMathService.GetOrientedRangeBox(new Collection <BusinessObject>(
                                                                                                       new List <BusinessObject>()
                            {
                                oObject
                            }));                                                                                        //OrientedRangeBox of the Object
                            RangeBoxIntersectionType intersectionType = oOrientedRBHC.Intersects(oObjectOrientedBox);   //Find Intersects b/w them
                            if (intersectionType == RangeBoxIntersectionType.Overlap)
                            {
                                //ClientServiceProvider.SelectSet.SelectedObjects.Add(oObject);
                                oDic["Overlap"].Add(oObject);
                                //foreach (var oPlaTest in MakePlane3D6ByOrientedRangeBox(oPipeOrientedBox))
                                //{
                                //    oHiliter3.HilitedObjects.Add(oPlaTest);
                                //}
                            }
                            else if (intersectionType == RangeBoxIntersectionType.Inside)
                            {
                                //ClientServiceProvider.SelectSet.SelectedObjects.Add(oObject);
                                oDic["Inside"].Add(oObject);
                                //foreach (var oPlaTest in MakePlane3D6ByOrientedRangeBox(oPipeOrientedBox))
                                //{
                                //    oHiliter2.HilitedObjects.Add(oPlaTest);
                                //}
                            }
                            else
                            {
                                refObjList.Remove(oObject);
                            }
                            foreach (KeyValuePair <string, List <BusinessObject> > item in oDic)
                            {
                                if (item.Key.Equals("Overlap"))
                                {
                                    foreach (var oBO in oDic[item.Key])
                                    {
                                        oHiliter3.HilitedObjects.Add(oBO);
                                    }
                                }
                                else if (item.Key.Equals("Inside"))
                                {
                                    foreach (var oBO in oDic[item.Key])
                                    {
                                        oHiliter2.HilitedObjects.Add(oBO);
                                    }
                                }
                            }
                            //Debug.Print(oObj.ObjectIDForQuery);
                        }
                        var oPlaColl  = MakePlane3D6ByOrientedRangeBox(oOrientedRangeBox);
                        var oPlaColl2 = MakePlane3D6ByOrientedRangeBox(oOrientedRBHC);

                        foreach (var oPlane in oPlaColl2)
                        {
                            oHiliter.HilitedObjects.Add(oPlane);
                        }

                        if (refObjList.Count == 0)
                        {
                            CreateOrUpdateDefect(oObj, 1, false, "", null, null);
                        }
                        else
                        {
                            Dictionary <string, string> DefectDic = new Dictionary <string, string>()
                            {
                                { "distance", _oSetting.Clearance.Value }
                            };
                            CreateOrUpdateDefect(oObj, 1, true, _oRuleDescriptionHelper.GetFullErrorDescription(1, DefectDic), refObjList, null);
                        }
                    }
                    else if (oObj is Slab && oObj.GetPropertyValue("IJNamedItem", "Name").ToString().Contains("Stair"))
                    {
                        IMathServices oMathService = new Math3d();
                        var           oSlab        = oObj as Slab;
                        //Matrix4X4 oMat = new Matrix4X4(oSlab.Matrix);
                        Collection <BusinessObject> oCollection = new Collection <BusinessObject>()
                        {
                            oSlab
                        };

                        // RangeBox 를 가져온다.
                        RangeBox oRange = (oSlab as IRange).Range;
                        // Calculate the distance value based on the unit recored on the configuration file
                        double height = MiddleServiceProvider.UOMMgr.ParseUnit(UnitType.Distance, _oSetting.Clearance.Value);
                        // 면적을 줄여준다. (20 mm)
                        RangeBox nRange = new RangeBox(new Position(oRange.Low.X + allowanceXY, oRange.Low.Y + allowanceXY, oRange.High.Z + allowanceZ),
                                                       new Position(oRange.High.X - allowanceXY, oRange.High.Y - allowanceXY, oRange.High.Z + height));
                        RangeBox         testRange         = new RangeBox();
                        OrientedRangeBox oOrientedRangeBox = oMathService.GetOrientedRangeBox(oCollection);
                        oOrientedRangeBox.GetExtendedOrientedRangeBoxInGivenDirection(new Vector(0, 0, 1), height, out oOrientedRangeBox, out testRange);

                        //JDObject(모든오브젝트)에 대한 Query 생성
                        string subQuery  = GenericUtils.GetSQLQueryBasedOnObjectTypeViewCriteria("JDObject");
                        string fullQuery = GenericUtils.GetSQLQueryForObjectsOverlappingRangeBox(nRange, subQuery);
                        //Excutes Query
                        SQLFilter oFilter = new SQLFilter();
                        oFilter.SetSQLFilterString(fullQuery);
                        var oColl = oFilter.Apply();                                    //Query에 걸리는 Object Collection
                        List <BusinessObject> refObjList = new List <BusinessObject>(); //BusinessObject List
                        List <String>         stringList = new List <String>();

                        //Highlight object
                        GraphicViewHiliter oHiliter = new GraphicViewHiliter();
                        oHiliter.Weight      = 5;
                        oHiliter.Color       = ColorConstants.RGBYellow;
                        oHiliter.LinePattern = HiliterBase.HiliterLinePattern.Dotted;
                        Hiliter oHiliter2 = new Hiliter();
                        oHiliter2.Weight = 10;
                        oHiliter2.Color  = ColorConstants.RGBBlue;
                        Hiliter oHiliter3 = new Hiliter();
                        oHiliter3.Weight = 3;
                        oHiliter3.Color  = ColorConstants.RGBWhite;
                        Dictionary <string, List <BusinessObject> > oDic = new Dictionary <string, List <BusinessObject> >();
                        oDic["Overlap"] = new List <BusinessObject>();
                        oDic["Inside"]  = new List <BusinessObject>();
                        ClientServiceProvider.SelectSet.SelectedObjects.Clear();

                        foreach (var oObject in oColl)
                        {
                            if (!IsSupportInerface(oObject))
                            {
                                refObjList.Add(oObject);
                                stringList.Add(oObject.ObjectID);
                            }
                            else
                            {
                                continue;
                            }

                            OrientedRangeBox oObjectOrientedBox = oMathService.GetOrientedRangeBox(new Collection <BusinessObject>(
                                                                                                       new List <BusinessObject>()
                            {
                                oObject
                            }));                                                                                          //OrientedRangeBox of the Object
                            RangeBoxIntersectionType intersectionType = oOrientedRangeBox.Intersects(oObjectOrientedBox); //Find Intersect b/w them
                            if (intersectionType == RangeBoxIntersectionType.Overlap)
                            {
                                //ClientServiceProvider.SelectSet.SelectedObjects.Add(oObject);
                                oDic["Overlap"].Add(oObject);
                                //foreach (var oPlaTest in MakePlane3D6ByOrientedRangeBox(oPipeOrientedBox))
                                //{
                                //    oHiliter3.HilitedObjects.Add(oPlaTest);
                                //}
                            }
                            else if (intersectionType == RangeBoxIntersectionType.Inside)
                            {
                                //ClientServiceProvider.SelectSet.SelectedObjects.Add(oObject);
                                oDic["Inside"].Add(oObject);
                                //foreach (var oPlaTest in MakePlane3D6ByOrientedRangeBox(oPipeOrientedBox))
                                //{
                                //    oHiliter2.HilitedObjects.Add(oPlaTest);
                                //}
                            }
                            foreach (KeyValuePair <string, List <BusinessObject> > item in oDic)
                            {
                                if (item.Key.Equals("Overlap"))
                                {
                                    foreach (var oBO in oDic[item.Key])
                                    {
                                        oHiliter3.HilitedObjects.Add(oBO);
                                    }
                                }
                                else if (item.Key.Equals("Inside"))
                                {
                                    foreach (var oBO in oDic[item.Key])
                                    {
                                        oHiliter2.HilitedObjects.Add(oBO);
                                    }
                                }
                            }
                            //Debug.Print(oObj.ObjectIDForQuery);
                        }
                        //var oPlaColl = MakePlane3D6ByOrientedRangeBox(oOrientedRangeBox);
                        var oPlaColl2 = MakePlane3D6ByOrientedRangeBox(oOrientedRangeBox);

                        foreach (var oPlane in oPlaColl2)
                        {
                            oHiliter.HilitedObjects.Add(oPlane);
                        }

                        if (refObjList.Count == 0)
                        {
                            CreateOrUpdateDefect(oObj, 1, false, "", null, null);
                        }
                        else
                        {
                            Dictionary <string, string> DefectDic = new Dictionary <string, string>()
                            {
                                { "distance", _oSetting.Clearance.Value }
                            };
                            CreateOrUpdateDefect(oObj, 1, true, _oRuleDescriptionHelper.GetFullErrorDescription(1, DefectDic), refObjList, null);
                        }
                    }
                }
            }
        }