Exemplo n.º 1
0
        protected MincostLiblinearClassifier(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context1)
            : base(info, context1)
        {
            m_delta = info.GetDouble("delta");
            m_mustValue = info.GetInt32("mustValue");

            string modelFileName = info.GetString("BaseCls");
            base.m_Classifier = (Classifier)weka.core.SerializationHelper.read(modelFileName);
        }
Exemplo n.º 2
0
 public static double GetDouble(System.Data.SqlClient.SqlDataReader rd, string field)
 {
     var index = rd.GetOrdinal(field);
     if (index < 0)
     {
         return 0;
     }
     else
     {
         if (rd.IsDBNull(index))
         {
             return 0;
         }
         else
         {
             return rd.GetDouble(index);
         }
     }
 }
Exemplo n.º 3
0
      /// <summary>
      /// Deserializes the XYPlotLayer Version 0.
      /// </summary>
      /// <param name="obj">The empty XYPlotLayer object to deserialize into.</param>
      /// <param name="info">The serialization info.</param>
      /// <param name="context">The streaming context.</param>
      /// <param name="selector">The deserialization surrogate selector.</param>
      /// <returns>The deserialized XYPlotLayer.</returns>
      public object SetObjectData(object obj, System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context, System.Runtime.Serialization.ISurrogateSelector selector)
      {
        XYPlotLayer s = (XYPlotLayer)obj;

        // XYPlotLayer style
        bool fillLayerArea = info.GetBoolean("FillLayerArea");
        BrushX layerAreaFillBrush = (BrushX)info.GetValue("LayerAreaFillBrush", typeof(BrushX));

        // size, position, rotation and scale

        s._location.WidthType = (XYPlotLayerSizeType)info.GetValue("WidthType", typeof(XYPlotLayerSizeType));
        s._location.HeightType = (XYPlotLayerSizeType)info.GetValue("HeightType", typeof(XYPlotLayerSizeType));
        s._location.Width = info.GetDouble("Width");
        s._location.Height = info.GetDouble("Height");
        s._cachedLayerSize = (SizeF)info.GetValue("CachedSize", typeof(SizeF));

        s._location.XPositionType = (XYPlotLayerPositionType)info.GetValue("XPositionType", typeof(XYPlotLayerPositionType));
        s._location.YPositionType = (XYPlotLayerPositionType)info.GetValue("YPositionType", typeof(XYPlotLayerPositionType));
        s._location.XPosition = info.GetDouble("XPosition");
        s._location.YPosition = info.GetDouble("YPosition");
        s._cachedLayerPosition = (PointF)info.GetValue("CachedPosition", typeof(PointF));

        s._location.Angle = info.GetSingle("Rotation");
        s._location.Scale = info.GetSingle("Scale");

        // axis related

        s._linkedScales.X.Scale = (Scale)info.GetValue("XAxis", typeof(Scale));
        s._linkedScales.Y.Scale = (Scale)info.GetValue("YAxis", typeof(Scale));
        s.LinkedScales.X.IsLinked = info.GetBoolean("LinkXAxis");
        s.LinkedScales.Y.IsLinked = info.GetBoolean("LinkYAxis");
        s.LinkedScales.X.LinkOrgA = info.GetDouble("LinkXAxisOrgA");
        s.LinkedScales.X.LinkOrgB = info.GetDouble("LinkXAxisOrgB");
        s.LinkedScales.X.LinkEndA = info.GetDouble("LinkXAxisEndA");
        s.LinkedScales.X.LinkEndB = info.GetDouble("LinkXAxisEndB");
        s.LinkedScales.Y.LinkOrgA = info.GetDouble("LinkYAxisOrgA");
        s.LinkedScales.Y.LinkOrgB = info.GetDouble("LinkYAxisOrgB");
        s.LinkedScales.Y.LinkEndA = info.GetDouble("LinkYAxisEndA");
        s.LinkedScales.Y.LinkEndB = info.GetDouble("LinkYAxisEndB");


        // Styles
        bool showLeft = info.GetBoolean("ShowLeftAxis");
        bool showBottom = info.GetBoolean("ShowBottomAxis");
        bool showRight = info.GetBoolean("ShowRightAxis");
        bool showTop = info.GetBoolean("ShowTopAxis");

        s._axisStyles.AxisStyleEnsured(CSLineID.Y0).AxisLineStyle = (AxisLineStyle)info.GetValue("LeftAxisStyle", typeof(AxisLineStyle));
        s._axisStyles.AxisStyleEnsured(CSLineID.X0).AxisLineStyle = (AxisLineStyle)info.GetValue("BottomAxisStyle", typeof(AxisLineStyle));
        s._axisStyles.AxisStyleEnsured(CSLineID.Y1).AxisLineStyle = (AxisLineStyle)info.GetValue("RightAxisStyle", typeof(AxisLineStyle));
        s._axisStyles.AxisStyleEnsured(CSLineID.X1).AxisLineStyle = (AxisLineStyle)info.GetValue("TopAxisStyle", typeof(AxisLineStyle));


        s._axisStyles[CSLineID.Y0].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("LeftLabelStyle", typeof(AxisLabelStyleBase));
        s._axisStyles[CSLineID.X0].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("BottomLabelStyle", typeof(AxisLabelStyleBase));
        s._axisStyles[CSLineID.Y1].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("RightLabelStyle", typeof(AxisLabelStyleBase));
        s._axisStyles[CSLineID.X1].MajorLabelStyle = (AxisLabelStyleBase)info.GetValue("TopLabelStyle", typeof(AxisLabelStyleBase));


        // Titles and legend
        s._axisStyles[CSLineID.Y0].Title = (TextGraphic)info.GetValue("LeftAxisTitle", typeof(TextGraphic));
        s._axisStyles[CSLineID.X0].Title = (TextGraphic)info.GetValue("BottomAxisTitle", typeof(TextGraphic));
        s._axisStyles[CSLineID.Y1].Title = (TextGraphic)info.GetValue("RightAxisTitle", typeof(TextGraphic));
        s._axisStyles[CSLineID.X1].Title = (TextGraphic)info.GetValue("TopAxisTitle", typeof(TextGraphic));

        if (!showLeft)
          s._axisStyles.Remove(CSLineID.Y0);
        if (!showRight)
          s._axisStyles.Remove(CSLineID.Y1);
        if (!showBottom)
          s._axisStyles.Remove(CSLineID.X0);
        if (!showTop)
          s._axisStyles.Remove(CSLineID.X1);


        s.Legend = (TextGraphic)info.GetValue("Legend", typeof(TextGraphic));



        // XYPlotLayer specific
        s._linkedLayer.SetDocNode((XYPlotLayer)info.GetValue("LinkedLayer", typeof(XYPlotLayer)), s);

        s._graphObjects = (GraphicCollection)info.GetValue("GraphObjects", typeof(GraphicCollection));

        s._plotItems = (PlotItemCollection)info.GetValue("Plots", typeof(PlotItemCollection));

        return s;
      }
Exemplo n.º 4
0
 protected RangeInfo(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {
     Name = info.GetString("Name");
     Min = info.GetDouble("Min");
     Max = info.GetDouble("Max");
     Tick = info.GetDouble("Tick");
     SnapToTick = info.GetBoolean("SnapToTick");
     SmallChange = info.GetDouble("SmallChange");
 }
 private VariantReference(System.Runtime.Serialization.SerializationInfo info, System.Runtime.Serialization.StreamingContext context)
 {
     var mode = (RefMode)info.GetByte("mode");
     switch(mode)
     {
         case RefMode.Value:
             _mode = RefMode.Value;
             _type = (VariantType)info.GetInt32("type");
             switch (_type)
             {
                 case VariantType.Object:
                 case VariantType.Null:
                     this.Value = null;
                     break;
                 case VariantType.String:
                     this.StringValue = info.GetString("value");
                     break;
                 case VariantType.Boolean:
                     this.BoolValue = info.GetBoolean("value");
                     break;
                 case VariantType.Integer:
                     this.IntValue = info.GetInt32("value");
                     break;
                 case VariantType.Float:
                     this.FloatValue = info.GetSingle("value");
                     break;
                 case VariantType.Double:
                     this.DoubleValue = info.GetDouble("value");
                     break;
                 case VariantType.Vector2:
                 case VariantType.Vector3:
                 case VariantType.Quaternion:
                 case VariantType.Color:
                     var arr = StringUtil.SplitFixedLength(info.GetString("value"), ",", 4);
                     _x = ConvertUtil.ToSingle(arr[0]);
                     _y = ConvertUtil.ToSingle(arr[1]);
                     _z = ConvertUtil.ToSingle(arr[2]);
                     _w = ConvertUtil.ToDouble(arr[3]);
                     break;
                 case VariantType.DateTime:
                     this.DateValue = info.GetDateTime("value");
                     break;
                 case VariantType.GameObject:
                 case VariantType.Component:
                     this.Value = null;
                     break;
             }
             break;
         case RefMode.Property:
             this.Value = null; //just set to null value
             break;
     }
 }
Exemplo n.º 6
0
 public double PreencheAtributo(System.Data.IDataReader lDataReader, int NumeroColuna, double Atributo)
 {
     if ((lDataReader.IsDBNull(NumeroColuna) == true))
     {
         return double.MinValue;
     }
     else
     {
         return lDataReader.GetDouble(NumeroColuna);
     }
 }