Exemplo n.º 1
0
        public override bool Read(GH_IReader reader)
        {
            bool refFlag = false;

            if (reader.TryGetBoolean("Massive Refinement", ref refFlag))
            {
                MassiveRefinement = refFlag;
            }

            return(base.Read(reader));
        }
Exemplo n.º 2
0
        public override bool Read(GH_IReader reader)
        {
            faces  = false;
            edgesE = false;
            edgesF = false;

            reader.TryGetBoolean("Display Faces", ref this.faces);
            reader.TryGetBoolean("Display Edges", ref this.edgesE);
            reader.TryGetBoolean("Display Edge Faces", ref this.edgesF);

            return(base.Read(reader));
        }
Exemplo n.º 3
0
        public static IDictionary <T1, T2> GetDictionary <T1, T2>(
            this GH_IReader reader,
            string itemName,
            int itemIndex,
            Func <GH_IReader, string, int, T1> keyGetter,
            Func <GH_IReader, string, int, T2> valueGetter
            )
        {
            var dataReader = reader.FindChunk(itemName, itemIndex);

            return(ReadDictionary(dataReader, keyGetter, valueGetter));
        }
Exemplo n.º 4
0
 /// <summary>
 /// De-serialization. Required by Grasshopper for data internalization.
 /// </summary>
 /// <param name="reader">The reader.</param>
 /// <returns>A bool when successful.</returns>
 public bool Read(GH_IReader reader)
 {
     if (reader.ItemExists("Name"))
     {
         Name = reader.GetString("Name");
         return(true);
     }
     else
     {
         return(false);
     }
 }
Exemplo n.º 5
0
        public override bool Read(GH_IReader reader)
        {
            if (!base.Read(reader))
            {
                return(false);
            }

            Simulated = default;
            reader.TryGetBoolean("Simulated", ref Simulated);

            return(true);
        }
Exemplo n.º 6
0
    public override bool Read(GH_IReader reader)
    {
        var shape = new List <int>();
        int cnt   = reader.GetInt32("ShapeCount");

        for (int i = 0, loopTo = cnt - 1; i <= loopTo; i += 1)
        {
            shape.Add(reader.GetInt32("S" + i));
        }
        this.Value = new Tensor(shape, reader.GetDoubleArray("Data"));
        return(true);
    }
Exemplo n.º 7
0
        private static IDictionary <T1, T2> ReadDictionary <T1, T2>(
            GH_IReader reader,
            Func <GH_IReader, string, int, T1> keyGetter,
            Func <GH_IReader, string, int, T2> valueGetter
            )
        {
            int itemCount = reader.GetInt32("PairCount");
            var keys      = Range(0, itemCount).Select(i => keyGetter(reader, "Key", i));
            var values    = Range(0, itemCount).Select(i => valueGetter(reader, "Value", i));

            return(keys.Zip(values, (key, value) => (key, value))
                   .ToDictionary(pair => pair.key, pair => pair.value));
        }
Exemplo n.º 8
0
 /// <summary>
 /// Read our own fields. Needed for (de)serialization of the variable input parameters.
 /// </summary>
 /// <param name="reader"> Provides access to a subset of GH_Chunk methods used for reading archives. </param>
 /// <returns> True on success, false on failure. </returns>
 public override bool Read(GH_IReader reader)
 {
     _previewMesh                  = reader.GetBoolean("Set Preview Mesh");
     _outputRobotEndPlane          = reader.GetBoolean("Output Robot End Plane");
     _outputRobotEndPlanes         = reader.GetBoolean("Output Robot End Planes");
     _outputRobotJointPosition     = reader.GetBoolean("Output Robot Joint Position");
     _outputRobotJointPositions    = reader.GetBoolean("Output Robot Joint Positions");
     _outputExternalAxisPlanes     = reader.GetBoolean("Output External Axis Planes");
     _outputExternalJointPosition  = reader.GetBoolean("Output External Joint Position");
     _outputExternalJointPositions = reader.GetBoolean("Output External Joint Positions");
     _outputErrorMessages          = reader.GetBoolean("Output Error Messages");
     return(base.Read(reader));
 }
Exemplo n.º 9
0
        /***************************************************/

        public override bool Read(GH_IReader reader)
        {
            string json = "";

            reader.TryGetString("Json", ref json);

            if (json != null && json.Length > 0)
            {
                Value = (Type)BH.Engine.Serialiser.Convert.FromJson(json);
            }

            return(true);
        }
Exemplo n.º 10
0
        public override bool Read(GH_IReader reader)
        {
            if (reader.ItemExists("ignoreAllWarningMsg"))
            {
                this._ignoreAllWarningMsg = reader.GetBoolean("ignoreAllWarningMsg");
            }
            if (reader.ItemExists(this._remoteFlyName))
            {
                this._remoteFly = reader.GetBoolean(this._remoteFlyName);
            }

            return(base.Read(reader));
        }
        public override bool Read(GH_IReader reader)
        {
            try
            {
                var methodId = reader.GetString("ccmethod");
                var www      = reader.GetString("www");
                selectedMethod     = Cc.METHODS[Convert.ToInt32(methodId)];
                selectedMethod.url = www;
            }
            catch { }

            return(base.Read(reader));
        }
Exemplo n.º 12
0
        public override bool Read(GH_IReader reader)
        {
            if (reader.ItemExists("Wave"))
            {
                Wave = Utils.WaveTypesFromString(reader.GetString("Wave"));
            }
            if (reader.ItemExists("Profile"))
            {
                Profile = Utils.WaveProfilesFromString(reader.GetString("Profile"));
            }

            return(base.Read(reader));
        }
Exemplo n.º 13
0
        public override bool Read(GH_IReader reader)
        {
            modeStatus  = reader.GetInt32("FilterMode");
            modeTitle   = reader.GetBoolean("Title");
            modeCtrl    = reader.GetBoolean("Ctrl");
            modeScrollH = reader.GetBoolean("ScrollH");
            modeScrollV = reader.GetBoolean("ScrollV");
            modeTrans   = reader.GetBoolean("Transparent");

            this.UpdateMessage();

            return(base.Read(reader));
        }
Exemplo n.º 14
0
        bool GH_ISerializable.Read(GH_IReader reader)
        {
            var pt = reader.GetPoint3D("Location");

            Text                = reader.GetString("Text");
            Font                = reader.GetString("Font");
            Colour              = reader.GetDrawingColor("Colour");
            Location            = new Point3d(pt.x, pt.y, pt.z);
            HorizontalAlignment = reader.GetDouble("Horizontal");
            VerticalAlignment   = reader.GetDouble("Vertical");
            Rotation            = reader.GetDouble("Rotation");
            return(true);
        }
Exemplo n.º 15
0
        /// <summary>
        /// This method is called whenever the instance is required to deserialize itself.
        /// </summary>
        /// <param name="reader"> Reader object to deserialize from. </param>
        /// <returns> True on success, false on failure. </returns>
        public override bool Read(GH_IReader reader)
        {
            if (!reader.ItemExists(IoKey))
            {
                this.Value = null;
                return(true);
            }

            byte[] array = reader.GetByteArray(IoKey);
            this.Value = (LinearConfigurationControl)HelperMethods.ByteArrayToObject(array);

            return(true);
        }
Exemplo n.º 16
0
        /// <summary>
        /// This method is called whenever the instance is required to deserialize itself.
        /// </summary>
        /// <param name="reader"> Reader object to deserialize from. </param>
        /// <returns> True on success, false on failure. </returns>
        public override bool Read(GH_IReader reader)
        {
            if (!reader.ItemExists(IoKey))
            {
                this.Value = null;
                return(true);
            }

            byte[] array = reader.GetByteArray(IoKey);
            this.Value = (ExternalRotationalAxis)HelperMethods.ByteArrayToObject(array);

            return(true);
        }
Exemplo n.º 17
0
        /// <summary>
        /// This method is called whenever the instance is required to deserialize itself.
        /// </summary>
        /// <param name="reader"> Reader object to deserialize from. </param>
        /// <returns> True on success, false on failure. </returns>
        public override bool Read(GH_IReader reader)
        {
            if (!reader.ItemExists(IoKey))
            {
                this.Value = null;
                return(true);
            }

            byte[] array = reader.GetByteArray(IoKey);
            this.Value = (RobotJointPosition)HelperMethods.ByteArrayToObject(array);

            return(true);
        }
Exemplo n.º 18
0
        public override bool Read(GH_IReader reader)
        {
            OrientMode   = reader.GetInt32("Orientation");
            IsHorizontal = reader.GetBoolean("Horizontal");
            IsExtents    = reader.GetBoolean("Extents");
            HasTicks     = reader.GetBoolean("Ticks");
            IsLight      = reader.GetBoolean("Light");
            IsFlipped    = reader.GetBoolean("Flipped");

            this.UpdateMessage();

            return(base.Read(reader));
        }
Exemplo n.º 19
0
        public override bool Read(GH_IReader reader)
        {
            // reading the json string and then deserializing it to set the options
            string optString = reader.GetString("Options");

            if (optString == null)
            {
                //the options were not serialized when the file was saved last time
                return(base.Read(reader));
            }
            this._settings = JsonConvert.DeserializeObject <Dictionary <string, bool> >(optString);

            return(base.Read(reader));
        }
        public override bool Read(GH_IReader reader)
        {
            string serialisedAccount = "";

            reader.TryGetString("selectedAccount", ref serialisedAccount);

            if (serialisedAccount != "")
            {
                SpeckleAccount myAccount = JsonConvert.DeserializeObject <SpeckleAccount>(serialisedAccount);
                Selected = myAccount;
            }

            return(base.Read(reader));
        }
        public override bool Read(GH_IReader reader)
        {
            GH_IReader gH_IReader = reader.FindChunk("Slider", Index);

            minValue     = gH_IReader.GetDouble("MinValue");
            maxValue     = gH_IReader.GetDouble("MaxValue");
            currentValue = gH_IReader.GetDouble("CurrentValue");
            if (!gH_IReader.TryGetInt32("NumDecimals", ref numDecimals))
            {
                numDecimals = 2;
            }
            FixValues();
            return(true);
        }
        public override bool Read(GH_IReader reader)
        {
            var point = reader.GetPoint4D("color");

            Value = new Rhino.Display.ColorRGBA
                    (
                point.x,
                point.y,
                point.z,
                point.w
                    );

            return(true);
        }
Exemplo n.º 23
0
        public override bool Read(GH_IReader reader)
        {
            if (!base.Read(reader))
            {
                return(false);
            }

            bool keepJoins = false;

            reader.TryGetBoolean("KeepJoins", ref keepJoins);
            KeepJoins = keepJoins;

            return(true);
        }
        public override bool Read(GH_IReader reader)
        {
            UseDefaultCache       = reader.GetBoolean("UseDefaultCache");
            AutoSend              = reader.GetBoolean("AutoSend");
            CurrentComponentState = reader.GetString("CurrentComponentState");
            BaseId = reader.GetString("BaseId");

            var wrappersRaw  = reader.GetString("OutputWrappers");
            var wrapperLines = wrappersRaw.Split('\n');

            if (wrapperLines != null && wrapperLines.Length != 0 && wrappersRaw != "")
            {
                foreach (var line in wrapperLines)
                {
                    var pieces = line.Split('\t');
                    OutputWrappers.Add(new StreamWrapper {
                        ServerUrl = pieces[0], StreamId = pieces[1], CommitId = pieces[2]
                    });
                }

                if (OutputWrappers.Count != 0)
                {
                    JustPastedIn = true;
                }
            }

            var kitName = "";

            reader.TryGetString("KitName", ref kitName);

            if (kitName != "")
            {
                try
                {
                    SetConverterFromKit(kitName);
                }
                catch (Exception e)
                {
                    AddRuntimeMessage(GH_RuntimeMessageLevel.Warning,
                                      $"Could not find the {kitName} kit on this machine. Do you have it installed? \n Will fallback to the default one.");
                    SetDefaultKitAndConverter();
                }
            }
            else
            {
                SetDefaultKitAndConverter();
            }

            return(base.Read(reader));
        }
Exemplo n.º 25
0
        public override bool Read(GH_IReader reader)
        {
            if (!base.Read(reader))
            {
                return(false);
            }

            int elevationBase = (int)DBX.ElevationBase.InternalOrigin;

            reader.TryGetInt32("ElevationBase", ref elevationBase);
            ElevationBase = (DBX.ElevationBase)elevationBase;

            return(true);
        }
 public override bool Read(GH_IReader reader)
 {
     try
     {
         GraftItems = reader.GetBoolean("GraftItemsToggle");
         Message    = getGraftMessage();
     }
     catch
     {
         GraftItems = true;
         Message    = getGraftMessage();
     }
     return(base.Read(reader));
 }
Exemplo n.º 27
0
        public override bool Read(GH_IReader reader)
        {
            GH_IReader val = reader.FindChunk("MenuDropDown", Index);

            try
            {
                current_value = val.GetInt32("ActiveItemIndex");
            }
            catch
            {
                current_value = default_item_index;
            }
            return(true);
        }
Exemplo n.º 28
0
        /// <summary>
        /// Read the Criterion
        /// </summary>
        /// <param name="reader">GH_IO.Serialization.GH_IReader: Provides acces to a subset of GH_Chunk methods used for reading archives.</param>
        /// <returns>Bool: true.</returns>
        public override bool Read(GH_IReader reader)
        {
            if (!reader.ItemExists("Criterion"))
            {
                Value = null;
                return(true);
            }

            var constraint = (ObjectCriterion)reader.GetInt32("Criterion");

            Value = Criter.SetCriterion(constraint);

            return(true);
        }
Exemplo n.º 29
0
        public override sealed bool Read(GH_IReader reader)
        {
            if (!base.Read(reader))
            {
                return(false);
            }

            int grouping = (int)DataGrouping.None;

            reader.TryGetInt32("Grouping", ref grouping);
            Grouping = (DataGrouping)grouping;

            return(true);
        }
Exemplo n.º 30
0
        public override bool Read(GH_IReader reader)
        {
            string serialisedStreamWrapper = null;

            reader.TryGetString("stream", ref serialisedStreamWrapper);

            if (serialisedStreamWrapper != null)
            {
                var pcs = serialisedStreamWrapper.Split(' ');
                stream = new StreamWrapper(pcs[0], pcs[2], pcs[1]);
            }

            return(base.Read(reader));
        }
Exemplo n.º 31
0
        public override bool Read(GH_IReader reader)
        {
            m_settings = null;

                    int count = 0;
                    reader.TryGetInt32("StringCount", ref count);
                    if (count > 0)
                    {
                        System.Array.Resize(ref m_settings, count);
                        for (int i = 0; i < count; i++)
                        {
                            string line = null;
                            reader.TryGetString("String", i, ref line);
                            m_settings[i] = line;
                        }
                    }

                    return base.Read(reader);
        }
Exemplo n.º 32
0
        //
        // Writing and Reading.
        // Any methods to save custom properties apart from those of the original
        // component should be defined here.
        // ______________________________________________

        public override bool Read(GH_IReader reader)
        {
            try
            {
                GH_IReader reader2 = reader.FindChunk("Hoopsnake_Data");
                if (reader2 != null)
                {
                    dataLimit = Int32.MaxValue;// FIX THAT!!! //int.Parse(reader2.GetInt32("dataLimit").ToString());
                    resetCounterOnLoop = reader2.GetBoolean("resetCounter");
                    updateView = reader2.GetBoolean("updateView");
                    autoUpdate = reader2.GetBoolean("autoUpdate");
                    int newDelay = 0;
                    reader2.TryGetInt32("delay", ref newDelay);
                }
            }
            catch {}
            // In the end, call the reader of the base component to load inherited fields.
            return base.Read(reader);
        }
Exemplo n.º 33
0
        public override bool Read(GH_IReader reader)
        {
            reader.TryGetBoolean("createNewSpreadsheets", ref m_createNewSpreadsheets);

            return base.Read(reader);
        }
Exemplo n.º 34
0
 public override bool Read(GH_IReader reader)
 {
     isCartesian = reader.GetBoolean("IsCartesian");
     return base.Read(reader);
 }