Ejemplo n.º 1
0
        // Required for all IDumpers for them to work, but can't enforced by the interface because it's static:
        public static RgbaColor CreateFromDump(SafeSharedObjects shared, Dump d)
        {
            var newObj = new RgbaColor();

            newObj.LoadDump(d);
            return(newObj);
        }
Ejemplo n.º 2
0
 public RgbaColor(RgbaColor copyFrom)
     : this()
 {
     SafeHouse.Logger.Log(" --RgbaColor.Construct-- ");
     Red   = copyFrom.Red;
     Green = copyFrom.Green;
     Blue  = copyFrom.Blue;
     Alpha = copyFrom.Alpha;
 }
Ejemplo n.º 3
0
 public RgbaColor(RgbaColor copyFrom)
     : this()
 {
     SafeHouse.Logger.Log(" --RgbaColor.Construct-- ");
     Red = copyFrom.Red;
     Green = copyFrom.Green;
     Blue = copyFrom.Blue;
     Alpha = copyFrom.Alpha;
 }
Ejemplo n.º 4
0
        private const int FLIGHT_LAYER = 0;  // found through trial-and-error

        public VectorRenderer(UpdateHandler updateHand, SharedObjects shared)
        {
            Vector = new Vector3d(0, 0, 0);
            Color  = new RgbaColor(1, 1, 1);
            Start  = new Vector3d(0, 0, 0);
            Scale  = 1.0;
            Width  = 0;

            updateHandler = updateHand;
            this.shared   = shared;
        }
Ejemplo n.º 5
0
 public HighlightStructure(UpdateHandler updateHandler, object toHighlight, RgbaColor color)
 {
     this.updateHandler = updateHandler;
     this.toHighlight = toHighlight;
     this.color = color;
     DetermineType();
     InitializeSuffixes();
     stale = true;
     enabled = true;
     updateHandler.AddObserver(this);
 }
Ejemplo n.º 6
0
        public VectorRenderer( UpdateHandler updateHand, SharedObjects shared )
        {
            Vector  = new Vector3d(0,0,0);
            Color   = new RgbaColor(1,1,1);
            Start   = new Vector3d(0,0,0);
            Scale   = 1.0;
            Width   = 0;

            updateHandler = updateHand;
            this.shared = shared;
            InitializeSuffixes();
        }
Ejemplo n.º 7
0
 private void InitializeSuffixes()
 {
     AddSuffix("COLOR", new SetSuffix<RgbaColor>(() => color, value =>
     {
         color = value;
         stale = true;
     }));
     AddSuffix("ENABLED", new SetSuffix<bool>(() => enabled, value =>
     {
         enabled = value;
         stale = true;
     }));
 }
Ejemplo n.º 8
0
        public VectorRenderer(UpdateHandler updateHand, SharedObjects shared)
        {
            Vector = new Vector3d(0, 0, 0);
            Color  = new RgbaColor(1, 1, 1);
            Start  = new Vector3d(0, 0, 0);
            Scale  = 1.0;
            Width  = 0;
            Pointy = false;
            Wiping = false;

            updateHandler = updateHand;
            this.shared   = shared;
            InitializeSuffixes();
        }
Ejemplo n.º 9
0
        public void DoExecuteWork(SharedObjects shared, Vector start, Vector vec, RgbaColor rgba, string str, double scale, bool show, double width)
        {
            var vRend = new VectorRenderer( shared.UpdateHandler, shared )
                {
                    Vector = vec,
                    Start = start,
                    Color = rgba,
                    Scale = scale,
                    Width = width
                };
            vRend.SetLabel( str );
            vRend.SetShow( show );

            ReturnValue = vRend;
        }
Ejemplo n.º 10
0
 public override void Execute(SharedObjects shared)
 {
     var a = (float) GetDouble(PopValueAssert(shared));
     var b = (float) GetDouble(PopValueAssert(shared));
     var g = (float) GetDouble(PopValueAssert(shared));
     var r = (float) GetDouble(PopValueAssert(shared));
     AssertArgBottomAndConsume(shared);
     ReturnValue = new RgbaColor(r,g,b,a);
 }
Ejemplo n.º 11
0
 public RgbaColor(RgbaColor copyFrom)
 {
     Safe.Utilities.Debug.Logger.Log("kOS: --RgbaColor.Construct-- ");
     color = copyFrom.color;
     InitializeSuffixColor();
 }
Ejemplo n.º 12
0
 public RgbaColor(RgbaColor copyFrom)
 {
     SafeHouse.Logger.Log(" --RgbaColor.Construct-- ");
     color = copyFrom.color;
     InitializeSuffixColor();
 }
Ejemplo n.º 13
0
        public override bool SetSuffix(string suffixName, object value)
        {
            double dblValue    = 0.0;
            bool   boolValue   = false;
            string strValue    = "";
            var    rgbaValue   = new RgbaColor(1, 1, 1);
            var    vectorValue = new Vector(0, 0, 0);

            // When the wrong type of value is given, attempt
            // to make at least SOME value out of it that won't crash
            // the system.  This was added because now the value can
            // be a wide variety of different types and this check
            // used to deny any of them being usable other than doubles.
            // This is getting a bit silly looking and something else
            // needs to be done, I think.
            if (value is double || value is int || value is float || value is long)
            {
                dblValue  = Convert.ToDouble(value);
                boolValue = (Convert.ToBoolean(value));
            }
            else if (value is bool)
            {
                boolValue = (bool)value;
                dblValue  = ((bool)value) ? 1.0 : 0.0;
            }
            else if (value is RgbaColor)
            {
                rgbaValue = (RgbaColor)value;
            }
            else if (value is Vector)
            {
                vectorValue = (Vector)value;
            }
            else if (value is String)
            {
                strValue = value.ToString();
            }
            else if (!double.TryParse(value.ToString(), out dblValue))
            {
                return(false);
            }

            switch (suffixName)
            {
            case "VEC":
            case "VECTOR":
                Vector = vectorValue.ToVector3D();
                RenderPointCoords();
                return(true);

            case "SHOW":
                SetShow(boolValue);
                return(true);

            case "COLOR":
            case "COLOUR":
                Color = rgbaValue;
                RenderColor();
                return(true);

            case "START":
                Start = vectorValue.ToVector3D();
                RenderPointCoords();
                return(true);

            case "SCALE":
                Scale = dblValue;
                RenderPointCoords();
                return(true);

            case "LABEL":
                SetLabel(strValue);
                return(true);

            case "WIDTH":
                Width = dblValue;
                RenderPointCoords();
                return(true);
            }

            return(base.SetSuffix(suffixName, value));
        }
Ejemplo n.º 14
0
 public RgbaColor( RgbaColor copyFrom )
 {
     color = copyFrom.color;
 }
Ejemplo n.º 15
0
 public RgbaColor(RgbaColor copyFrom)
 {
     color = copyFrom.color;
 }