コード例 #1
0
ファイル: frmEdit.cs プロジェクト: waternk/BASINS
 private void SetAxisFromControls(Axis aAxis)
 {
     if (aAxis != null)
     {
         aAxis.Title.Text = txtAxisLabel.Text;
         double lTemp;
         if (double.TryParse(txtAxisDisplayMinimum.Text, out lTemp))
         {
             aAxis.Scale.Min = lTemp;
         }
         if (double.TryParse(txtAxisDisplayMaximum.Text, out lTemp))
         {
             aAxis.Scale.Max = lTemp;
         }
         AxisType lNewType = AxisType.Linear;
         switch (cboAxisType.SelectedIndex)
         {
             case 0: 
                 lNewType = AxisType.DateDual;
                 //TODO: parse min/max date from textboxes
                 break;
             case 1: lNewType = AxisType.Linear;    break;
             case 2: lNewType = AxisType.Log;       break;
             //case 3: lNewType = AxisType.Probability; break;           
         }
         if (aAxis.Type != lNewType)
         {
             aAxis.Type = lNewType;
         }
         aAxis.MajorGrid.IsVisible = chkAxisMajorGridVisible.Checked;
         aAxis.MajorGrid.Color = txtAxisMajorGridColor.BackColor;
         aAxis.MinorGrid.IsVisible = chkAxisMinorGridVisible.Checked;
         aAxis.MinorGrid.Color = txtAxisMinorGridColor.BackColor;
     }
 }
コード例 #2
0
ファイル: RotaryAxis.cs プロジェクト: nickcooksey/UtilityLibs
 public RotaryAxis(int axisNumber, string name, AxisType type, string plcVariable, uint encoderCtsPerRev, uint encoderOffset)
     : base(axisNumber, name, type, plcVariable)
 {
     this.encoderOffset = encoderOffset;
     encoderCtsPerUnit  = encoderCtsPerRev;
     init();
 }
コード例 #3
0
        private static bool TryAddSeries(
            List <Series> series,
            string name,
            IDictionary <DateTime, BigInteger> data,
            string color,
            int numDecimals,
            AxisType yAxisType)
        {
            if (data == null || data.Count == 0)
            {
                return(false);
            }

            series.Add(new Series
            {
                Name  = name,
                Color = color,
                Data  = data
                        .Select(datum => new Point
                {
                    X = datum.Key.ToJavascriptTime(),
                    Y = datum.Value.ToString("F" + numDecimals),
                })
                        .Concat(new[]
                {
                    new Point
                    {
                        X = DateTime.UtcNow.ToJavascriptTime(),
                        Y = data.Last().Value.ToString("F" + numDecimals),
                    },
                })
                        .ToList(),
            });
            return(true);
        }
コード例 #4
0
 private void ZAxisRadioBtn_Checked(object sender, RoutedEventArgs e)
 {
     axis = AxisType.Z;
     xAxisRadioBtn.IsChecked = false;
     yAxisRadioBtn.IsChecked = false;
     UpdateAnimation();
 }
コード例 #5
0
ファイル: DerivedWS.cs プロジェクト: wallenius71/Wind-Dev
        private void AssignColIndex(IAxis axis, SessionColumnCollection collection)
        {
            AxisType type = axis.AxisType;

            switch (type)
            {
            case AxisType.Month:
            {
                axis.SessionColIndex = collection.DateIndex;
                break;
            }

            case AxisType.Hour:
            {
                axis.SessionColIndex = collection.DateIndex;
                break;
            }

            case AxisType.WD:
            {
                axis.SessionColIndex = collection.WDComp(collection.DataSetStart);
                break;
            }

            case AxisType.WS:
            {
                axis.SessionColIndex = collection.UpperWSComp(collection.DataSetStart);
                break;
            }

            default:
                axis.SessionColIndex = 0;
                break;
            }
        }
コード例 #6
0
                public float Get(JoystickID id, AxisType axis)
                {
                    // 軸から値の取得
                    switch (axis)
                    {
                    case AxisType.XPlus:
                    case AxisType.XMinus:
                        return(GetX(id) * axis.GetSign());

                    case AxisType.YPlus:
                    case AxisType.YMinus:
                        return(GetY(id) * axis.GetSign());

                    case AxisType.ZPlus:
                    case AxisType.ZMinus:
                        return(GetZ(id) * axis.GetSign());

                    case AxisType.RPlus:
                    case AxisType.RMinus:
                        return(GetR(id) * axis.GetSign());

                    case AxisType.UPlus:
                    case AxisType.UMinus:
                        return(GetU(id) * axis.GetSign());

                    case AxisType.VPlus:
                    case AxisType.VMinus:
                        return(GetV(id) * axis.GetSign());
                    }
                    return(float.NaN);
                }
コード例 #7
0
ファイル: AxisExt.cs プロジェクト: nrvllrgrs/unity-util
    public static Vector3 GetAxis(this Transform transform, AxisType axisType)
    {
        switch (axisType)
        {
        case AxisType.Forward:
            return(transform.forward);

        case AxisType.Up:
            return(transform.up);

        case AxisType.Right:
            return(transform.right);

        case AxisType.Back:
            return(-transform.forward);

        case AxisType.Down:
            return(-transform.up);

        case AxisType.Left:
            return(-transform.right);
        }

        return(Vector3.zero);
    }
コード例 #8
0
        public Plane FindGizmoTranslationPlane(Ray pickRay, AxisType translationAxis)
        {
            Vector3 vPos = Selected.DerivedPosition;
            Vector3 vCamBack = ActiveViewport.CameraEditor.Camera.DerivedDirection;
            vCamBack = -vCamBack;

            if (translationAxis == AxisType.None)
                return new Plane(vCamBack, vPos);

            Quaternion qOrient = Selected.DerivedOrientation;
            Plane planeX = new Plane(qOrient.XAxis, vPos);
            Plane planeY = new Plane(qOrient.YAxis, vPos);
            Plane planeZ = new Plane(qOrient.ZAxis, vPos);

            float vX = planeX.ProjectVector(pickRay.Direction).Length;
            float vY = planeY.ProjectVector(pickRay.Direction).Length;
            float vZ = planeZ.ProjectVector(pickRay.Direction).Length;

            if ((int)(translationAxis & AxisType.X) != 0)
                vX = 10000.0f;
            if ((int)(translationAxis & AxisType.Y) != 0)
                vY = 10000.0f;
            if ((int)(translationAxis & AxisType.Z) != 0)
                vZ = 10000.0f;

            if (vX < vY && vX < vZ)
                return planeX;
            else
            {
                if (vY < vX && vY < vZ)
                    return planeY;
                else
                    return planeZ;
            }
        }
コード例 #9
0
ファイル: InputState.cs プロジェクト: bzgeb/unity-input
    public float GetAxis(AxisType axis)
    {
        if( axisValues == null )
            axisValues = new float[System.Enum.GetValues(typeof(AxisType)).Length];

        return axisValues[(int)axis];
    }
コード例 #10
0
ファイル: InputState.cs プロジェクト: bzgeb/unity-input
    public void SetAxis(AxisType axis, float val)
    {
        if( axisValues == null )
            axisValues = new float[System.Enum.GetValues(typeof(AxisType)).Length];

        axisValues[(int)axis] = val;
    }
コード例 #11
0
        public Scale MakeNewScale(Scale oldScale, AxisType type)
        {
            switch (type)
            {
            case AxisType.Linear:
                return(null);

            case AxisType.Date:
                return(null);

            //case AxisType.Log:
            //    return new LogScale(oldScale, _ownerAxis);
            //case AxisType.Exponent:
            //    return new ExponentScale(oldScale, _ownerAxis);
            //case AxisType.Ordinal:
            //    return new OrdinalScale(oldScale, _ownerAxis);
            //case AxisType.Text:
            //    return new TextScale(oldScale, _ownerAxis);
            //case AxisType.DateAsOrdinal:
            //    return new DateAsOrdinalScale(oldScale, _ownerAxis);
            //case AxisType.LinearAsOrdinal:
            //    return new LinearAsOrdinalScale(oldScale, _ownerAxis);
            default:
                throw new Exception("Implementation Error: Invalid AxisType");
            }
        }
コード例 #12
0
        internal void SetAxis(AxisModel axis, AxisType type)
        {
            Debug.Assert(axis != null, "axis should not be null!");
            if (type == AxisType.First)
            {
                if (this.FirstAxes.Contains(axis))
                {
                    return;
                }
                this.FirstAxes.Add(axis);
                if (axis.isPrimary)
                {
                    this.primaryFirstAxis = axis;
                }
            }
            else
            {
                if (this.SecondAxes.Contains(axis))
                {
                    return;
                }
                this.SecondAxes.Add(axis);
                if (axis.isPrimary)
                {
                    this.primarySecondAxis = axis;
                }
            }

            axis.Type = type;
            this.AttachAxis(axis);
        }
コード例 #13
0
        private Series CreateLineSerie(string name, AxisType yAxisType)
        {
            Series serie = new Series(GetSeriesName(name));

            serie.LegendText = GetLegendName(name);
            serie.ChartType  = SeriesChartType.Line;
            serie.YAxisType  = yAxisType;
            if (yAxisType == AxisType.Primary)
            {
                serie.BorderDashStyle = ChartDashStyle.Solid;
                serie.MarkerStyle     = MarkerStyle.None;
                serie.BorderWidth     = 2;
            }
            else
            {
                serie.BorderDashStyle = ChartDashStyle.Dash;
                serie.MarkerStyle     = MarkerStyle.Circle;
                serie.BorderWidth     = 2;
                serie.MarkerSize      = serie.BorderWidth * 4;
            }
            serie.Enabled           = true;
            serie.XValueType        = ChartValueType.Double;
            serie.YValueType        = ChartValueType.Double;
            serie.IsVisibleInLegend = true;
            serie.ToolTip           = FilePath;

            serie.Tag = this;
            return(serie);
        }
コード例 #14
0
ファイル: RotaryAxis.cs プロジェクト: nickcooksey/UtilityLibs
 public RotaryAxis(int axisNumber, string name, AxisType type, string plcVariable)
     : base(axisNumber, name, type, plcVariable)
 {
     encoderOffset     = 0;
     encoderCtsPerUnit = 1080000;
     init();
 }
コード例 #15
0
ファイル: VirtualGamepad.cs プロジェクト: ADM87/GameSys
 public void RemoveControlListener(AxisType axisType, GamepadControlChangeEvent listener)
 {
     if (ControlMap.ContainsKey(axisType))
     {
         ControlMap[axisType].GamepadControlChange -= listener;
     }
 }
コード例 #16
0
        public Axis(int number, string name, AxisType type, string plcVariable)
        {
            if (number >= 0)
            {
                AxisNumber = number;
            }
            else
            {
                AxisNumber = 0;
            }

            if (name != null && name != "")
            {
                Name = name;
            }
            else
            {
                Name = "Axis" + AxisNumber.ToString();
            }



            if (plcVariable != null && plcVariable != "")
            {
                PLCVarName = plcVariable;
            }
            else
            {
                PLCVarName = "NONE" + AxisNumber.ToString();
            }

            Type = type;
        }
コード例 #17
0
ファイル: ILAxis.cs プロジェクト: zhufengGNSS/ILNumerics
 /// <summary>
 /// construct ILAxis object. This contructor is not to be called directly.
 /// </summary>
 /// <param name="name">type of the axis: XAxis,YAxis,ZAxis</param>
 /// <param name="clippingView">Clipping data to be registered into the axis.</param>
 /// <param name="layoutData">additional layout data, does currently only contain the camera [depricated]</param>
 /// <param name="panel">panel hosting the scene</param>
 /// <remarks>ILAxis objects are created GL-device dependend by use of a device dependend ILPanel instance's
 /// member ILPanel.CreateAxis(). This acts like a factory pattern. The specific axis derivate will be
 /// created by the derived ILPanel object (ILDXPanel or ILOGLPanel).</remarks>
 public ILAxis(AxisNames name, ILClippingData clippingView,
               ILLayoutData layoutData, ILPanel panel)
 {
     m_panel                 = panel;
     m_axisName              = name;
     m_labeledTicks          = new ILTickCollection(panel, m_axisName);
     m_layoutData            = layoutData;
     m_labelProvider         = null;
     m_labeledTicks.Changed += new AxisChangedEventHandler(m_labeledTicks_Changed);
     m_unLabeledTicks        = new List <UnlabeledTick>(10);
     m_grid                   = new ILLineProperties();
     m_grid.Style             = LineStyle.Dashed;
     m_grid.Changed          += new EventHandler(m_grid_Changed);
     m_clipping               = clippingView;
     m_axisType               = AxisType.Linear;
     m_nearLines              = new ILLineProperties();
     m_nearLines.Color        = Color.DarkBlue;
     m_nearLines.Width        = 1;
     m_nearLines.Antialiasing = true;
     m_nearLines.Changed     += new EventHandler(m_grid_Changed);
     m_farLines               = new ILLineProperties();
     m_farLines.Color         = Color.DarkBlue;
     m_farLines.Width         = 1;
     m_farLines.Antialiasing  = true;
     m_farLines.Changed      += new EventHandler(m_grid_Changed);
     m_label                  = new ILLabel(panel);
     m_label.Changed         += new EventHandler(m_label_Changed);
     m_clipping.Changed      += new ILClippingDataChangedEvent(m_clipping_Changed);
     m_invalidated            = true;
 }
コード例 #18
0
ファイル: InputDevice.cs プロジェクト: shadow7412/unity-input
    public float GetAxisRaw(AxisType axisType)
    {
        string axisStr = config.GetAxis(axisType);

        if (axisStr == "")
        {
            return(0);
        }

        if (config.isJoystick)
        {
            axisStr = axisStr.Replace("#", deviceId.ToString());
            return(Input.GetAxisRaw(axisStr));
        }
        else
        {
            string[] axisStringSplit = axisStr.Split(' ');
            int      axisVal         = 0;
            if (Input.GetKey(axisStringSplit[0]))
            {
                axisVal++;
            }
            if (Input.GetKey(axisStringSplit[1]))
            {
                axisVal--;
            }
            return(axisVal);
        }
    }
コード例 #19
0
    public Axis(string name, AxisType type, string unityAxis)
    {
        axisName = name;
        axisType = type;

        unityAxisName = unityAxis;
    }
コード例 #20
0
        private static float GetAxisValueInternal(Keys plusKey, Keys minusKey, AxisType axis, float povAngleOffset)
        {
            for (int i = 0; i < JoystickCount; i++)
            {
                if (!joystickAvailable[i])
                {
                    continue;
                }

                float threshold = Program.Configuration.Input.AxisAnalogThreshold;

                var value = joystickState[i].Axis.Get((JoystickID)i, axis);
                if (value < -threshold || threshold < value)
                {
                    return(value);
                }

                if ((joystickState[i].Flags & JoyInfoFlags.ReturnPOV) != 0)
                {
                    //Program.AddStatistics("POV", "[#{0}]{1}", i, joystickState[i].POV);
                    if (joystickState[i].POV != 0xffff)
                    {
                        var povAngle = joystickState[i].POV / 18000.0f * MathF.PI;

                        return(MathF.Cos(povAngle + povAngleOffset));
                    }
                }
            }


            return((stat.IsKeyDown(plusKey) ? 1.0f : 0.0f)
                   + (stat.IsKeyDown(minusKey) ? -1.0f : 0.0f));
        }
コード例 #21
0
ファイル: AxisUtil.cs プロジェクト: SBStudio/MagicCube
    public static Vector3 Axis2Direction(Transform transform, AxisType axisType)
    {
        if (AxisType.UP == axisType)
        {
            return transform.up;
        }
        else if (AxisType.DOWN == axisType)
        {
            return -transform.up;
        }
        else if (AxisType.LEFT == axisType)
        {
            return -transform.right;
        }
        else if (AxisType.RIGHT == axisType)
        {
            return transform.right;
        }
        else if (AxisType.FORWARD == axisType)
        {
            return transform.forward;
        }

        return -transform.forward;
    }
コード例 #22
0
        private static void VerifyAxisType(AxisPlacement axisPlacement, AxisType axisType)
        {
            bool result = false;

            switch (axisPlacement)
            {
            case AxisPlacement.Left:
            case AxisPlacement.Right:
                result = axisType == AxisType.Vertical;
                break;

            case AxisPlacement.Top:
            case AxisPlacement.Bottom:
                result = axisType == AxisType.Horizontal;
                break;

            default:
                break;
            }

            if (!result)
            {
                throw new ArgumentException(Strings.Exceptions.InvalidAxisPlacement);
            }
        }
コード例 #23
0
ファイル: LineChart.cs プロジェクト: pachman/ngchart
 public LineChart(ChartSize size, ChartData data, AxisType axisTypes, AxisLabels labels, DataScale dataScale)
     : base(LineTypeDefinition, size, data)
 {
     _labels = labels;
     _axisType = axisTypes;
     _dataScale = dataScale;
 }
コード例 #24
0
        public void ZoomScale_ZoomOnCenterValue(AxisType axisType)
        {
            IFixture fixture      = new Fixture().Customize(new ZedGraphCustomization());
            double   zoomFraction = this.random.NextDouble() * 2;
            var      min          = fixture.Create <double>();
            double   centerValue  = min + fixture.Create <double>();
            double   max          = centerValue + fixture.Create <double>();
            Axis     axis         = fixture.Create <Axis>()
                                    .OfType(axisType)
                                    .WithScale(min, max);
            Scale  scale       = axis.Scale;
            double linearMax   = scale.Linearize(max);
            double linearMin   = scale.Linearize(min);
            double expectedMin = scale.DeLinearize(centerValue - ((centerValue - linearMin) * zoomFraction));
            double expectedMax = scale.DeLinearize(centerValue + ((linearMax - centerValue) * zoomFraction));
            var    sut         = new TestZedGraphControl();

            sut.ZoomScale(axis, zoomFraction, centerValue, ZoomOnCenterValue);

            Assert.That(
                scale.Min,
                Is.EqualTo(expectedMin)
                .Within(0.001),
                "The scale's minimum was not the expected value");
            Assert.That(
                scale.Max,
                Is.EqualTo(expectedMax)
                .Within(0.001),
                "The scale's maximum was not the expected value");
            Assert.That(scale.MinAuto, Is.False, "The scale's automatic minimum flag was not set to false");
            Assert.That(scale.MinAuto, Is.False, "The scale's automatic maximum flag was not set to false");
        }
コード例 #25
0
ファイル: Chart.cs プロジェクト: Egaros/MvvmChart
        /// <summary>
        /// Detect if plotting setting changed. If true, then re-plot the axis & gridline
        /// </summary>
        /// <param name="orientation"></param>
        private void TryUpdatePlottingSettings(AxisType orientation)
        {
            if (!this.IsLoaded)
            {
                return;
            }

            var newValue = GetPlottingSettings(orientation);

            switch (orientation)
            {
            case AxisType.X:
                if (this._horizontalPlottingRangeSetting != newValue)
                {
                    this._horizontalPlottingRangeSetting = newValue;
                    this.HorizontalSettingChanged?.Invoke(newValue);
                }
                break;

            case AxisType.Y:
                if (this._verticalPlottingRangeSetting != newValue)
                {
                    this._verticalPlottingRangeSetting = newValue;
                    this.VerticalSettingChanged?.Invoke(newValue);
                }
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(orientation), orientation, null);
            }
        }
コード例 #26
0
    private BVHNode BuildBVH(List <Triangle> triangles, int depth)
    {
        Bounds bounds = GetTrianglesBounds(triangles);

        if (depth == m_MaxDepth)
        {
            return(new BVHNode(triangles, bounds));
        }

        AxisType atype = AxisType.X;

        if (bounds.size.y >= bounds.size.x && bounds.size.y >= bounds.size.z)
        {
            atype = AxisType.Y;
        }
        else if (bounds.size.z >= bounds.size.x && bounds.size.z >= bounds.size.y)
        {
            atype = AxisType.Z;
        }

        float value = GetSplitAxis(triangles, atype);

        List <Triangle> negative = new List <Triangle>();
        List <Triangle> positive = new List <Triangle>();

        for (int i = 0; i < triangles.Count; i++)
        {
            SplitTriangle(triangles[i], negative, positive, atype, value);
        }

        BVHNode left  = BuildBVH(negative, depth + 1);
        BVHNode right = BuildBVH(positive, depth + 1);

        return(new BVHNode(left, right, bounds));
    }
コード例 #27
0
        public InputControl(string name, string descName, string descNegName,
                            string negButton, string posButton, string altNegButton,
                            string altPosButton, float grav, float dead,
                            float sensitivity, bool snap, bool invert,
                            AxisType type, AxisNum axisNum, JoyNum joyNum)
        {
            Name                    = name;
            DescriptiveName         = descName;
            DescriptiveNegativeName = descNegName;
            NegativeButton          = negButton;
            PositiveButton          = posButton;
            AltNegativeButton       = altNegButton;
            AltPositiveButton       = altPosButton;

            Gravity     = grav;
            Dead        = dead;
            Sensitivity = sensitivity;

            Snap   = snap;
            Invert = invert;

            Type = type;

            AxisNum = axisNum;
            JoyNum  = joyNum;
        }
コード例 #28
0
        public int Add(ChartData d)
        {
            int index = end;

            if (index > (list.Length - 1))
            {
                ChartData[] list1 = new ChartData[list.Length * 2];
                list.CopyTo(list1, 0);
                list = list1;
            }
            list[index] = d;
            end++;

            //Set default values
            if (d.AutoScale)
            {
                autoscale = true;
            }

            if (d.AxisTypeX == AxisType.LOG)
            {
                atx = AxisType.LOG;
            }

            if (d.AxisTypeY == AxisType.LOG)
            {
                aty = AxisType.LOG;
            }

            //Rescale();

            return(index);
        }
コード例 #29
0
ファイル: InputManager.cs プロジェクト: QuickMick/protowar
 internal Axis(InputManager p, string n, AxisType type, float sensitivity = 1.0f)
 {
     parent           = p;
     this.Name        = n;
     this.Type        = type;
     this.Sensitivity = sensitivity;
 }
コード例 #30
0
        private void SetDefaultFromIndexesOrData(Axis axis, AxisType axisType)
        {
            ArrayList xAxesSeries = GetXAxesSeries(axisType, axis.SubAxisName);
            bool      flag        = true;

            foreach (string item in xAxesSeries)
            {
                if (!ChartElement.IndexedSeries(base.Common.DataManager.Series[item]))
                {
                    flag = false;
                    break;
                }
            }
            if (flag)
            {
                if (axis.Logarithmic)
                {
                    throw new InvalidOperationException(SR.ExceptionChartAreaAxisScaleLogarithmicUnsuitable);
                }
                SetDefaultFromIndexes(axis);
            }
            else
            {
                SetDefaultFromData(axis);
                axis.EstimateAxis();
            }
        }
コード例 #31
0
ファイル: LineChart.cs プロジェクト: pachman/ngchart
 public LineChart(ChartSize size, ChartData data, AxisType axisTypes, AxisLabels labels, AxisRange ranges)
     : base(LineTypeDefinition, size, data)
 {
     _labels = labels;
     _axisType = axisTypes;
     _ranges = ranges;
 }
コード例 #32
0
        internal ArrayList GetXAxesSeries(AxisType type, string subAxisName)
        {
            ArrayList arrayList = new ArrayList();

            if (series.Count == 0)
            {
                return(arrayList);
            }
            if (!IsSubAxesSupported && subAxisName.Length > 0)
            {
                return(arrayList);
            }
            foreach (string item in series)
            {
                if (base.Common.DataManager.Series[item].XAxisType == type)
                {
                    arrayList.Add(item);
                }
            }
            if (arrayList.Count == 0)
            {
                if (type == AxisType.Secondary)
                {
                    return(GetXAxesSeries(AxisType.Primary, string.Empty));
                }
                return(GetXAxesSeries(AxisType.Secondary, string.Empty));
            }
            return(arrayList);
        }
コード例 #33
0
ファイル: PageSetupAxes.cs プロジェクト: SetCode/Fluid
        private void AxisControl_HomeClicked(Axis obj)
        {
            AxisType type = (AxisType)obj.Key;

            switch (type)
            {
            case AxisType.X轴:
                Machine.Instance.Robot.MoveHomeX();
                break;

            case AxisType.Y轴:
                Machine.Instance.Robot.MoveHomeY();
                break;

            case AxisType.Z轴:
                Machine.Instance.Robot.MoveHomeZ();
                break;

            case AxisType.A轴:
                Machine.Instance.Robot.MoveHomeA();
                break;

            case AxisType.B轴:
                Machine.Instance.Robot.MoveHomeB();
                break;

            case AxisType.U轴:
                Machine.Instance.Robot.MoveHomeU();
                break;
            }
        }
コード例 #34
0
    public float GetAxis(AxisType axisType, AxisDir dir)
    {
        var axisVector = _axes[axisType];
        var value      = dir == AxisDir.Horizontal ? axisVector.x : axisVector.y;

        return(value);
    }
コード例 #35
0
        public AxisConfig()
        {
            _calibMin    = -32767;
            _calibCenter = 0;
            _calibMax    = 32767;

            _isInverted   = false;
            _offsetAngle  = 0;
            _isOutEnabled = true;

            _sourceMain      = AxisSourceType.Buttons;
            _sourceSecondary = AxisType.X;
            _function        = AxisFunction.None;

            _decrementButton = 0;
            _incrementButton = 0;
            _centerButton    = 0;
            _step            = 0;

            _resolution = 16;
            _deadband   = 0;

            _channel    = 0;
            _i2cAddress = AxisAddressType.ADS1115_00;

            _curveShape = new ObservableCollection <Point>();
            for (int i = 0; i < 11; i++)
            {
                _curveShape.Add(new Point(i, 0));
            }
            _filterLevel = 0;

            _isCalibCenterUnlocked = false;
        }
コード例 #36
0
    float GetAxisRaw(AxisType axisType)
    {
        InputDeviceConfig.AxisMapping mapping = config.GetAxisMapping(axisType);
        if (mapping == null)
        {
            return(0);
        }

        string axisStr = mapping.axis;

        if (config.isJoystick)
        {
            axisStr = axisStr.Replace("#", deviceId.ToString());
            return(Input.GetAxisRaw(axisStr) * mapping.InverseFactor);
        }
        else
        {
            string[] axisStringSplit = axisStr.Split(' ');
            int      axisVal         = 0;
            if (Input.GetKey(axisStringSplit[0]))
            {
                axisVal++;
            }
            if (Input.GetKey(axisStringSplit[1]))
            {
                axisVal--;
            }
            return(axisVal * mapping.InverseFactor);
        }
    }
コード例 #37
0
        public DirectXControllerAxis(DirectXControllerInterface controllerInterface, AxisType type, int axisNumber, JoystickState initialState)
        {
            _axisType = type;
            _axisNumber = axisNumber;

            _value = new HeliosValue(controllerInterface, new BindingValue(GetValue(initialState)), "", Name, "Current value for " + Name + ".", "(0 - 65536)", BindingValueUnits.Numeric);
            _triggers.Add(_value);
        }
コード例 #38
0
ファイル: BaseInputSource.cs プロジェクト: GR-2015/Heasmodex
    protected float GetAxis(string axisName, AxisType type = AxisType.Normal)
    {
        float value = 0f;

        value = type == AxisType.Normal ? Input.GetAxis(axisName) : Input.GetAxisRaw(axisName);

        return value;
    }
コード例 #39
0
ファイル: axis.cs プロジェクト: cornelius90/InnovatorAdmin
 // constructor
 internal Axis(AxisType axistype, AstNode input) {
     _axistype = axistype;
     _input = input;
     _prefix = String.Empty;
     _name = String.Empty;
     _nodetype =  XPathNodeType.All;
     this.abbrAxis = true;
 }
コード例 #40
0
ファイル: Axis.cs プロジェクト: uQr/referencesource
 // constructor
 public Axis(AxisType axisType, AstNode input, string prefix, string name, XPathNodeType nodetype) {
     Debug.Assert(prefix != null);
     Debug.Assert(name   != null);
     this.axisType = axisType;
     this.input    = input;
     this.prefix   = prefix;
     this.name     = name;
     this.nodeType = nodetype;
 }
コード例 #41
0
 public Axis(AxisType axisType, AstNode input, string prefix, string name, XPathNodeType nodetype)
 {
     this.urn = string.Empty;
     this.axisType = axisType;
     this.input = input;
     this.prefix = prefix;
     this.name = name;
     this.nodeType = nodetype;
 }
コード例 #42
0
ファイル: Axis.cs プロジェクト: noahfalk/corefx
 // constructor
 public Axis(AxisType axisType, AstNode input, string prefix, string name, XPathNodeType nodetype)
 {
     Debug.Assert(prefix != null);
     Debug.Assert(name != null);
     _axisType = axisType;
     _input = input;
     _prefix = prefix;
     _name = name;
     _nodeType = nodetype;
 }
コード例 #43
0
    public bool windowsOnly = false; //use this for OS-specific config

    #endregion Fields

    #region Methods

    public string GetAxis(AxisType axisType)
    {
        foreach(AxisMapping mapping in axisMappings)
        {
            if( mapping.target == axisType )
                return mapping.axis;
        }

        return "";
    }
コード例 #44
0
ファイル: axis.cs プロジェクト: cornelius90/InnovatorAdmin
 // constructor
 internal Axis(
              AxisType axistype,
              AstNode input,
              String prefix,
              String name,
              XPathNodeType nodetype) {
     _axistype = axistype;
     _input = input;
     _prefix = prefix;
     _name = name;
     _nodetype = nodetype;
 }
コード例 #45
0
ファイル: InputAxisMap.cs プロジェクト: kourbou/Pixel
        /// <summary>
        /// Creates a new InputAxisMap
        /// </summary>
        /// <param name="MouseButton">
        /// The key that will trigger this action
        /// </param>
        public InputAxisMap(AxisType triggerType, object trigger, AxisType? secondTriggerType = null, object secondTrigger = null)
        {
            TriggerType = triggerType;
            Trigger = trigger; ;

            if (secondTrigger != null)
            {
                SecondTriggerType = secondTriggerType.Value;
                SecondTrigger = secondTrigger;
            } else
                SecondTriggerType = AxisType.None;
        }
コード例 #46
0
ファイル: Axis.cs プロジェクト: eprimo/Linc-Reporting-Service
 public Axis(GraphPane pane)
 {
     mPane = pane;
     mMaximum = 0;
     mMinimum = 0;
     mScale = 1.0f;
     mTitle = new AxisTitle();
     mLabels = new AxisLabels();
     mMajorMark = new AxisMark(15.0f);
     mMinorMark = new AxisMark(6.0f);
     mAxisType = AxisType.Linear;
     mPen = SystemPens.ControlText;
 }
コード例 #47
0
ファイル: AxisUtil.cs プロジェクト: SBStudio/MagicCube
    public static void GetRollAxis(Transform transform,
	                               Vector3 right,
	                               Vector3 forward,
	                               out AxisType rightAxis,
	                               out AxisType upAxis,
	                               out AxisType forwardAxis)
    {
        Vector3 r = default(Vector3), u = default(Vector3), f = default(Vector3);
        List<Vector3> axisList = new List<Vector3>()
        {
            transform.right,
            transform.up,
            transform.forward
        };

        for (int i = axisList.Count; --i >= 0;)
        {
            if (default(Vector3) == r)
            {
                r = axisList[i];

                continue;
            }

            float project1 = Vector3.Project(right, r).magnitude;
            float project2 = Vector3.Project(right, axisList[i]).magnitude;
            r = project1 > project2 ? r : axisList[i];
        }
        axisList.Remove(r);

        for (int i = axisList.Count; --i >= 0;)
        {
            if (default(Vector3) == f)
            {
                f = axisList[i];

                continue;
            }

            float project1 = Vector3.Project(forward, f).magnitude;
            float project2 = Vector3.Project(forward, axisList[i]).magnitude;
            f = project1 > project2 ? f : axisList[i];
        }
        axisList.Remove(f);

        u = axisList[0];

        rightAxis = Direction2Axis(transform, r);
        upAxis = Direction2Axis(transform, u);
        forwardAxis = Direction2Axis(transform, f);
    }
コード例 #48
0
ファイル: Axes.cs プロジェクト: dixonte/STC.Automation.Office
 /// <summary>
 /// Index the Axes collection to get an axis
 /// </summary>
 /// <param name="type">Specifies the axis to return.</param>
 /// <param name="group">Specifies the axis group. If this argument is omitted, the primary group is used. 3-D charts have only one axis group.</param>
 /// <returns></returns>
 public Axis this[AxisType type, AxisGroup group]
 {
     get
     {
         try
         {
             return new Axis(InternalObject.GetType().InvokeMember("Item", System.Reflection.BindingFlags.InvokeMethod, null, InternalObject, new object[] { (int)type, (int)group }));
         }
         catch (Exception ex)
         {
             throw new IndexOutOfRangeException(String.Concat("Could not find axis '", type, "', '", group, "'."), ex);
         }
     }
 }
コード例 #49
0
ファイル: Player.cs プロジェクト: SBStudio/MagicCube
    public void SetCube(CubeItem cube, AxisType rightAxis, AxisType upAxis, AxisType forwardAxis)
    {
        this.cube = cube;
        this.rightAxis = rightAxis;
        this.upAxis = upAxis;
        this.forwardAxis = forwardAxis;

        Vector3 forward = AxisUtil.Axis2Direction(cube.transform, forwardAxis);
        Vector3 right = AxisUtil.Axis2Direction(cube.transform, rightAxis);
        Vector3 up = AxisUtil.Axis2Direction(cube.transform, upAxis);

        transform.SetParent(cube.transform);
        transform.rotation = Quaternion.LookRotation(forward, up);
        transform.position = cube.transform.position + transform.up * cube.size * 0.5f;
    }
コード例 #50
0
    public AxisType type; //受け取る軸の種類

    #endregion Fields

    #region Constructors

    //コンストラクタ
    public AxisData()
    {
        name                     = "";
        descriptiveName          = "";
        descriptiveNegativeName  = "";
        negativeButton           = "";
        positiveButton           = "";
        altNegativeButton        = "";
        altPositiveButton        = "";
        gravity                  = 0;
        dead                     = 0;
        sensitivity              = 0;
        snap                     = false;
        invert                   = false;
        type                     = AxisType.KeyOrMouseButton;
        axis                     = 1;
        joyNum                   = 0;
    }
コード例 #51
0
ファイル: InputDevice.cs プロジェクト: bzgeb/unity-input
    public float GetAxisRaw(AxisType axisType)
    {
        string axisStr = config.GetAxis(axisType);
        if( axisStr == "" )
            return 0;

        if( config.isJoystick )
        {
            axisStr = axisStr.Replace("#",deviceId.ToString());
            return Input.GetAxisRaw(axisStr);
        }
        else
        {
            string[] axisStringSplit = axisStr.Split(' ');
            int axisVal = 0;
            if( Input.GetKey(axisStringSplit[0]) )
                axisVal++;
            if( Input.GetKey(axisStringSplit[1]) )
                axisVal--;
            return axisVal;
        }
    }
コード例 #52
0
 ResultCell[] GetXSerieCells(AxisType xAxisType, ResultCell[] row, ResultCell[] col, ReportModel model)
 {
     ReportElement[] elements = model.GetXElements(xAxisType).ToArray();
     return GetResultCells(elements, row, col);
 }
コード例 #53
0
ファイル: Axis.cs プロジェクト: noahfalk/corefx
 // constructor
 public Axis(AxisType axisType, AstNode input)
     : this(axisType, input, string.Empty, string.Empty, XPathNodeType.All)
 {
     this.abbrAxis = true;
 }
コード例 #54
0
ファイル: InputDevice.cs プロジェクト: bzgeb/unity-input
    void UpdateAxisSmooth(AxisType axis)
    {
        float lastVal = lastState.GetAxis(axis);
        float currentVal = GetAxisRaw(axis);

        currentVal = Mathf.InverseLerp(config.deadZone,1,Mathf.Abs(currentVal)) * Mathf.Sign(currentVal); // apply dead zone (todo: radial dead zone based on 2d distance)

        float maxDelta = Time.deltaTime*config.sensitivity;

        if( Mathf.Sign(lastVal) != Mathf.Sign(currentVal)) // move faster towards zero
           maxDelta *= 2;

        currentVal = Mathf.Clamp( lastVal + Mathf.Clamp(currentVal-lastVal,-maxDelta,maxDelta), -1, 1 );
        currentState.SetAxis(axis,currentVal);
    }
コード例 #55
0
ファイル: GamepadAxis.cs プロジェクト: vetuomia/rocket
 /// <summary>
 /// Initializes a new instance of the <see cref="GamepadAxis"/> class.
 /// </summary>
 /// <param name="gamepad">The gamepad.</param>
 /// <param name="code">The input code.</param>
 /// <param name="name">The input name.</param>
 /// <param name="type">The axis type.</param>
 public GamepadAxis(Gamepad gamepad, int code, string name, AxisType type) : base(gamepad, code, name, type)
 {
     this.Gamepad = gamepad;
 }
コード例 #56
0
 public static string AxisTypeToStr(AxisType at) {
   string ret = VisionLabPINVOKE.AxisTypeToStr((int)at);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
   return ret;
 }
コード例 #57
0
 public static void MapAxis(ComplexDoubleImage inputImage, ComplexDoubleImage outputImage, AxisType xAxis, AxisType yAxis) {
   VisionLabPINVOKE.MapAxis__SWIG_28(ComplexDoubleImage.getCPtr(inputImage), ComplexDoubleImage.getCPtr(outputImage), (int)xAxis, (int)yAxis);
   if (VisionLabPINVOKE.SWIGPendingException.Pending) throw VisionLabPINVOKE.SWIGPendingException.Retrieve();
 }
コード例 #58
0
ファイル: MapCollidable.cs プロジェクト: coler706/CaveStory
        private void Update(ICollisionRectangle collisionRectangle,
            IAccelerator accelerator,
            Kinematics kinematicsX, Kinematics kinematicsY,
            GameTime gameTime, Map map,
            BitArray maybeGroundTile,
            Kinematics kinematics, AxisType axis)
        {
            Func<Map, Rectangle, TileInfo.SideType, BitArray, CollisionInfo?> testMapCollisionFunc;
            if (collisionType == CollisionType.BouncingCollision)
            {
                testMapCollisionFunc = TestMapBouncingCollision;
            }
            else
            {
                testMapCollisionFunc = TestMapStickyCollision;
            }

            accelerator.UpdateVelocity(kinematics, gameTime);
            GameUnit delta = kinematics.velocity * (float)gameTime.ElapsedGameTime.TotalMilliseconds;

            TileInfo.SideType direction = axis == AxisType.XAxis ?
                (delta > 0 ? TileInfo.SideType.RightSide : TileInfo.SideType.LeftSide) :
                (delta > 0 ? TileInfo.SideType.BottomSide : TileInfo.SideType.TopSide);
            CollisionInfo? maybeInfo = testMapCollisionFunc(map,
                collisionRectangle.Collision(direction, kinematicsX.position, kinematicsY.position, delta),
                direction, maybeGroundTile);

            if (maybeInfo.HasValue)
            {
                kinematics.position = maybeInfo.Value.position - collisionRectangle.BoundingBox.Side(direction);
                debugCollidingTiles.Add(maybeInfo.Value.tilePosition);
                OnCollision(direction, true, maybeInfo.Value.tileType);
            }
            else
            {
                kinematics.position += delta;
                OnDelta(direction);
            }

            maybeInfo = null;
            TileInfo.SideType oppositeDirection = TileInfo.OppositeSide(direction);
            maybeInfo = testMapCollisionFunc(map,
                collisionRectangle.Collision(oppositeDirection, kinematicsX.position, kinematicsY.position, 0),
                oppositeDirection, null);

            if (maybeInfo.HasValue)
            {
                kinematics.position = maybeInfo.Value.position - collisionRectangle.BoundingBox.Side(oppositeDirection);
                debugOppositeCollidingTiles.Add(maybeInfo.Value.tilePosition);
                OnCollision(oppositeDirection, false, maybeInfo.Value.tileType);
            }
        }
コード例 #59
0
ファイル: ReportModel.cs プロジェクト: cnark/Seal-Report
 public IEnumerable<ReportElement> GetSplitterElements(AxisType xAxisType)
 {
     return Elements.Where(i => ((i.XAxisType == xAxisType && i.SerieDefinition == SerieDefinition.Splitter) || i.SerieDefinition == SerieDefinition.SplitterBoth) && (i.PivotPosition == PivotPosition.Row || i.PivotPosition == PivotPosition.Column));
 }
コード例 #60
0
ファイル: ReportModel.cs プロジェクト: cnark/Seal-Report
 public IEnumerable<ReportElement> GetXElements(AxisType xAxisType)
 {
     return Elements.Where(i => i.XAxisType == xAxisType && (i.PivotPosition == PivotPosition.Row || i.PivotPosition == PivotPosition.Column) && (i.SerieDefinition == SerieDefinition.Axis));
 }