示例#1
0
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            string roomInstancesListString = reader.GetString("RoomInstancesListString");

            string[] strArray = roomInstancesListString.Split('@');

            foreach (string guidS in strArray)
            {
                try
                {
                    roomInstancesList.Add(Owner.OnPingDocument().FindComponent(
                                              new System.Drawing.Point(int.Parse(guidS.Split('!')[0]), int.Parse(guidS.Split('!')[1]))) as RoomInstance);
                }
                catch (Exception e) { }
            }
            //  roomInstancesListString.Remove(roomInstancesListString.Length - 1);

            (Owner as HouseInstance).HouseName         = reader.GetString("HouseName");
            (Owner as HouseInstance).FloorName         = reader.GetString("FloorName");
            (Owner as HouseInstance).tryRotateBoundary = reader.GetBoolean("TryRotateBoundary");

            Owner.ExpireSolution(true);

            return(base.Read(reader));
        }
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            string roomInstancesListString = reader.GetString("TargetObjectList");

            writerTargetObjectsListString = roomInstancesListString.Split('@');

            // roomInstancesListString.Remove(roomInstancesListString.Length - 1);

            (Owner as RoomInstance).RoomName = reader.GetString("RoomName");                  //, (Owner as RoomInstance).RoomName);
                                                                                              //    (Owner as RoomInstance).RoomId = (uint)reader.GetInt32("RoomId");//, (int)(Owner as RoomInstance).RoomId);
            (Owner as RoomInstance).RoomArea = (int)Math.Floor(reader.GetDouble("RoomArea")); //, (Owner as RoomInstance).RoomArea);

            RoomInstance.entranceIds = new List <int>();
            string temp = "";

            try
            {
                temp = reader.GetString("EntranceIds");
            }
            catch (Exception e) { }

            if (temp != null && temp.Length > 0)
            {
                string[] tempList = temp.Split('&');
                foreach (string s in tempList)
                {
                    RoomInstance.entranceIds.Add(Int32.Parse(s));
                }
            }

            Owner.ExpireSolution(true);

            return(base.Read(reader));
        }
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            // when a GH file is opened we need to read in the data that was previously set by user

            _mode = (FoldMode)reader.GetInt32("Mode");

            // dropdown content list
            int dropdownCount = reader.GetInt32("dropdownCount");

            dropdowncontents = new List <List <string> >();
            for (int i = 0; i < dropdownCount; i++)
            {
                int           dropdowncontentsCount = reader.GetInt32("dropdowncontentsCount" + i);
                List <string> tempcontent           = new List <string>();
                for (int j = 0; j < dropdowncontentsCount; j++)
                {
                    tempcontent.Add(reader.GetString("dropdowncontents" + i + j));
                }
                dropdowncontents.Add(tempcontent);
            }
            // spacer list
            int dropdownspacerCount = reader.GetInt32("spacerCount");

            dropdownspacer = new List <string>();
            for (int i = 0; i < dropdownspacerCount; i++)
            {
                dropdownspacer.Add(reader.GetString("spacercontents" + i));
            }
            // selection list
            int selectionsCount = reader.GetInt32("selectionCount");

            selections = new List <string>();
            for (int i = 0; i < selectionsCount; i++)
            {
                selections.Add(reader.GetString("selectioncontents" + i));
            }

            loadlistid   = reader.GetInt32("loadlistid");
            loadselectid = reader.GetInt32("loadselectid");

            catalogueIndex        = reader.GetInt32("catalogueIndex");
            catalogueTypeIndex    = reader.GetInt32("catalogueTypeIndex");
            catalogueProfileIndex = reader.GetInt32("catalogueProfileIndex");

            isTapered    = reader.GetBoolean("isTapered");
            isHollow     = reader.GetBoolean("isHollow");
            isElliptical = reader.GetBoolean("isElliptical");
            isGeneral    = reader.GetBoolean("isGeneral");
            isB2B        = reader.GetBoolean("isB2B");

            // we need to recreate the custom UI again as this is created before this read IO is called
            // otherwise the component will not display the selected items on the canvas
            this.CreateAttributes();
            return(base.Read(reader));
        }
示例#4
0
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            try
            {
                show3d            = reader.GetBoolean("Generate3d");
                individualOutputs = reader.GetBoolean("IndividualOutputs");
                way = reader.GetString("Feature");
                System.Globalization.TextInfo ti = new System.Globalization.CultureInfo("en-US", false).TextInfo;
                wayFT = ElkLib.FeatureType.Building;
                bool tryEnum = Enum.TryParse(ti.ToTitleCase(way), out wayFT);

                if (wayFT == ElkLib.FeatureType.Building)
                {
                    show3dMenuItem.Enabled = true;
                }
                else
                {
                    show3dMenuItem.Enabled = false;
                    show3d = false;
                }

                selectedTypes = new List <string>();
                bool keepGoing = true;
                int  i         = 0;
                while (keepGoing)
                {
                    try
                    {
                        string selection = reader.GetString("SelectedTypes", i);
                        if (selection != null && selection != string.Empty)
                        {
                            selectedTypes.Add(selection);
                        }
                        else
                        {
                            keepGoing = false;
                        }
                    }
                    catch
                    {
                        keepGoing = false;
                    }
                    i++;
                }

                AdjustParams();
            }
            catch (Exception ex)
            {
                System.Windows.Forms.MessageBox.Show("ReadError:\n" + ex.ToString());
            }
            return(base.Read(reader));
        }
示例#5
0
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     //_mode = (FoldMode)reader.GetInt32("Mode");
     fileName = (string)reader.GetString("File");
     //advanced = (bool)reader.GetBoolean("Advanced");
     return(base.Read(reader));
 }
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     _mode        = (FoldMode)reader.GetInt32("Mode");
     selecteditem = reader.GetString("select");
     this.CreateAttributes();
     return(base.Read(reader));
 }
示例#7
0
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     // First read our own field.
     Input_id = reader.GetString("Input_id");
     // Then call the base class implementation.
     return(base.Read(reader));
 }
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            string roomInstancesListString = reader.GetString("RoomInstancesListString");

            strArray = roomInstancesListString.Split('@');



            (Owner as HouseInstance).HouseName         = reader.GetString("HouseName");
            (Owner as HouseInstance).FloorName         = reader.GetString("FloorName");
            (Owner as HouseInstance).tryRotateBoundary = reader.GetBoolean("TryRotateBoundary");

            Owner.ExpireSolution(false);

            UpdateRoomInstancesColors();
            return(base.Read(reader));
        }
        // To persist selection state variables we need to override Read to check for state in the definiton
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            if (reader.ItemExists(this.storageKeyForHideObscure)) // Load form UI state (e.g. hide obscure)
            {
                this.hideObscureFeatures = reader.GetBoolean(storageKeyForHideObscure);
            }

            // Load selected items stored as key=value lists
            if (reader.ItemExists(storageKeyForSelectionState))
            {
                var stateKeyValues = reader.GetString(storageKeyForSelectionState);
                if (!string.IsNullOrEmpty(stateKeyValues))
                {
                    this.storedSelectionState = reader.GetString(storageKeyForSelectionState);
                }
            }
            return(base.Read(reader));
        }
示例#10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="reader"></param>
        /// <returns></returns>
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            if (reader.ItemExists("allSavedText"))
            {
                writtenText = reader.GetString("allSavedText");
                PythonIDE.PythonCanvas.Text = writtenText;
            }

            return(base.Read(reader));
        }
示例#11
0
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            var b = base.Read(reader);

            var t = reader.GetString("TurtleMesh");

            m_value = Turtle.Serialization.Persistance.Read(new StringReader(t));

            return(b);
        }
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            // when a GH file is opened we need to read in the data that was previously set by user
            selecteditem = (string)reader.GetString("selected");

            // we need to recreate the custom UI again as this is created before this read IO is called
            // otherwise the component will not display the selected item on the canvas
            this.CreateAttributes();
            return(base.Read(reader));
        }
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     // when a GH file is opened we need to read in the data that was previously set by user
     if (selections == null)
     {
         List <string> tempsel = new List <string>();
         tempsel.Add((string)reader.GetString("list"));
         tempsel.Add((string)reader.GetString("item"));
         selections = tempsel;
     }
     else
     {
         selections[0] = (string)reader.GetString("list");
         selections[1] = (string)reader.GetString("item");
     }
     // we need to recreate the custom UI again as this is created before this read IO is called
     // otherwise the component will not display the selected items on the canvas
     this.CreateAttributes();
     return(base.Read(reader));
 }
示例#14
0
        public override bool Read(GH_IO.Serialization.GH_IReader reader)
        {
            elements = new List <string>();
            bool keepMoving = true;
            int  i          = 0;

            while (keepMoving)
            {
                try
                {
                    string value = reader.GetString("Element", i);
                    elements.Add(value);
                    i++;
                }
                catch
                {
                    keepMoving = false;
                }
            }
            return(base.Read(reader));
        }
示例#15
0
 // Deserialize this instance from a Grasshopper reader object.
 public override bool Read(GH_IO.Serialization.GH_IReader reader)
 {
     this.directoryPath = reader.GetString("strPath");
     return(base.Read(reader));
 }