Пример #1
0
        protected void UpdateAxis(AAxis updatedAxis)
        {
            var single = new List <AAxis>();

            single.Add(updatedAxis);
            UpdateAxes(single);
        }
Пример #2
0
 public override void OnDispose(AAxis observable)
 {
     // Axis.Dispose() can only be called from AETV
     // do nothing here, but unsubscribe
     observedAxes.Remove(observable);
     UpdateAxes(observedAxes);
     // No need to Unsubscribe, since Observable clears Observer-List anyways
 }
Пример #3
0
        public static float MeanDistanceBetween(AAxis axisA, AAxis axisB)
        {
            var tipA  = axisA.GetAxisTipGlobal();
            var baseA = axisA.GetAxisBaseGlobal();
            var tipB  = axisB.GetAxisTipGlobal();
            var baseB = axisB.GetAxisBaseGlobal();

            return(((baseA - baseB).magnitude + (baseA - tipB).magnitude + (tipA - baseB).magnitude + (tipA - tipB).magnitude) / 4f);
        }
Пример #4
0
        ///////////////////////////////////////////////////////////////////////////////////
        //..................................................................... IGPObserver

        /// <summary>
        /// Adds the given axis to the list of permanently observed axes.
        /// If observed, axis can span metavisualizations between them, if
        /// they fullfill given factors.
        /// </summary>
        /// <param name="axis"></param>
        public override void Observe(AAxis observable)
        {
            // do not observe axes of meta-visualizations
            if (!observable.Base().isMetaVis)
            {
                observable.Subscribe(this);
                observedAxes.Add(observable);
                normalVisualizations.Add(observable.Base());

                UpdateAxis(observable);
            }
        }
Пример #5
0
        public override AETV CreateFlexiblePCP(DataSet data, string[] attIDs, AAxis axisA, AAxis axisB)
        {
            var flexPCP = Instantiate(ETV3DFlexiblePCPPrefab);

            // Get attribute IDs of the given attributes.
            int[] nomIDs, ordIDs, ivlIDs, ratIDs;
            AttributeProcessor.ExtractAttributeIDs(data, attIDs, out nomIDs, out ordIDs, out ivlIDs, out ratIDs);

            flexPCP.Init(data, nomIDs, ordIDs, ivlIDs, ratIDs, axisA, axisB, true);
            flexPCP.DrawGraph();

            return(flexPCP);
        }
Пример #6
0
        public void RegisterAxis(AAxis axis)
        {
            if (!registeredAxes.ContainsKey(axis.attributeName))
            {
                registeredAxes.Add(axis.attributeName, new List <AAxis>());
            }
            registeredAxes[axis.attributeName].Add(axis);
            axis.Assign(this);

            if (!isMetaVis)
            {
                Services.MetaVisSys().Observe(axis.GetComponent <AAxis>());
            }
        }
Пример #7
0
        /// <inheritdoc />
        public bool Equals([AllowNull] Ternary other)
        {
            if (other == null)
            {
                return(false);
            }
            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return
                ((
                     Domain == other.Domain ||
                     Domain != null &&
                     Domain.Equals(other.Domain)
                     ) &&
                 (
                     BgColor == other.BgColor ||
                     BgColor != null &&
                     BgColor.Equals(other.BgColor)
                 ) &&
                 (
                     Sum == other.Sum ||
                     Sum != null &&
                     Sum.Equals(other.Sum)
                 ) &&
                 (
                     AAxis == other.AAxis ||
                     AAxis != null &&
                     AAxis.Equals(other.AAxis)
                 ) &&
                 (
                     BAxis == other.BAxis ||
                     BAxis != null &&
                     BAxis.Equals(other.BAxis)
                 ) &&
                 (
                     CAxis == other.CAxis ||
                     CAxis != null &&
                     CAxis.Equals(other.CAxis)
                 ) &&
                 (
                     UiRevision == other.UiRevision ||
                     UiRevision != null &&
                     UiRevision.Equals(other.UiRevision)
                 ));
        }
Пример #8
0
        public bool Equals([AllowNull] Carpet other)
        {
            if (other == null)
            {
                return(false);
            }

            if (ReferenceEquals(this, other))
            {
                return(true);
            }

            return((Type == other.Type && Type != null && other.Type != null && Type.Equals(other.Type)) &&
                   (Visible == other.Visible && Visible != null && other.Visible != null && Visible.Equals(other.Visible)) &&
                   (Opacity == other.Opacity && Opacity != null && other.Opacity != null && Opacity.Equals(other.Opacity)) &&
                   (Name == other.Name && Name != null && other.Name != null && Name.Equals(other.Name)) &&
                   (UId == other.UId && UId != null && other.UId != null && UId.Equals(other.UId)) &&
                   (Equals(Ids, other.Ids) || Ids != null && other.Ids != null && Ids.SequenceEqual(other.Ids)) &&
                   (Equals(CustomData, other.CustomData) || CustomData != null && other.CustomData != null && CustomData.SequenceEqual(other.CustomData)) &&
                   (Meta == other.Meta && Meta != null && other.Meta != null && Meta.Equals(other.Meta)) &&
                   (Equals(MetaArray, other.MetaArray) || MetaArray != null && other.MetaArray != null && MetaArray.SequenceEqual(other.MetaArray)) &&
                   (Stream == other.Stream && Stream != null && other.Stream != null && Stream.Equals(other.Stream)) &&
                   (UiRevision == other.UiRevision && UiRevision != null && other.UiRevision != null && UiRevision.Equals(other.UiRevision)) &&
                   (_Carpet == other._Carpet && _Carpet != null && other._Carpet != null && _Carpet.Equals(other._Carpet)) &&
                   (Equals(X, other.X) || X != null && other.X != null && X.SequenceEqual(other.X)) &&
                   (Equals(Y, other.Y) || Y != null && other.Y != null && Y.SequenceEqual(other.Y)) &&
                   (Equals(A, other.A) || A != null && other.A != null && A.SequenceEqual(other.A)) &&
                   (A0 == other.A0 && A0 != null && other.A0 != null && A0.Equals(other.A0)) &&
                   (DA == other.DA && DA != null && other.DA != null && DA.Equals(other.DA)) &&
                   (Equals(B, other.B) || B != null && other.B != null && B.SequenceEqual(other.B)) &&
                   (B0 == other.B0 && B0 != null && other.B0 != null && B0.Equals(other.B0)) &&
                   (Db == other.Db && Db != null && other.Db != null && Db.Equals(other.Db)) &&
                   (CheaterSlope == other.CheaterSlope && CheaterSlope != null && other.CheaterSlope != null && CheaterSlope.Equals(other.CheaterSlope)) &&
                   (AAxis == other.AAxis && AAxis != null && other.AAxis != null && AAxis.Equals(other.AAxis)) &&
                   (BAxis == other.BAxis && BAxis != null && other.BAxis != null && BAxis.Equals(other.BAxis)) &&
                   (Font == other.Font && Font != null && other.Font != null && Font.Equals(other.Font)) &&
                   (Color == other.Color && Color != null && other.Color != null && Color.Equals(other.Color)) &&
                   (XAxis == other.XAxis && XAxis != null && other.XAxis != null && XAxis.Equals(other.XAxis)) &&
                   (YAxis == other.YAxis && YAxis != null && other.YAxis != null && YAxis.Equals(other.YAxis)) &&
                   (IdsSrc == other.IdsSrc && IdsSrc != null && other.IdsSrc != null && IdsSrc.Equals(other.IdsSrc)) &&
                   (CustomDataSrc == other.CustomDataSrc && CustomDataSrc != null && other.CustomDataSrc != null && CustomDataSrc.Equals(other.CustomDataSrc)) &&
                   (MetaSrc == other.MetaSrc && MetaSrc != null && other.MetaSrc != null && MetaSrc.Equals(other.MetaSrc)) &&
                   (XSrc == other.XSrc && XSrc != null && other.XSrc != null && XSrc.Equals(other.XSrc)) &&
                   (YSrc == other.YSrc && YSrc != null && other.YSrc != null && YSrc.Equals(other.YSrc)) &&
                   (ASrc == other.ASrc && ASrc != null && other.ASrc != null && ASrc.Equals(other.ASrc)) &&
                   (BSrc == other.BSrc && BSrc != null && other.BSrc != null && BSrc.Equals(other.BSrc)));
        }
Пример #9
0
 public static bool CheckIfNearEnoughToHideAxis(AAxis originalAxis, AAxis metaAxis)
 {
     if (
         ((originalAxis.GetAxisBaseGlobal() - metaAxis.GetAxisBaseGlobal()).magnitude < triggerInvisibleDistance ||
          (originalAxis.GetAxisBaseGlobal() - metaAxis.GetAxisTipGlobal()).magnitude < triggerInvisibleDistance)
         &&
         ((originalAxis.GetAxisTipGlobal() - metaAxis.GetAxisTipGlobal()).magnitude < triggerInvisibleDistance ||
          (originalAxis.GetAxisTipGlobal() - metaAxis.GetAxisTipGlobal()).magnitude < triggerInvisibleDistance)
         )
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
Пример #10
0
        public override int GetHashCode()
        {
            unchecked // Overflow is fine, just wrap
            {
                int hashCode = 41;

                if (Domain != null)
                {
                    hashCode = hashCode * 59 + Domain.GetHashCode();
                }

                if (BgColor != null)
                {
                    hashCode = hashCode * 59 + BgColor.GetHashCode();
                }

                if (Sum != null)
                {
                    hashCode = hashCode * 59 + Sum.GetHashCode();
                }

                if (AAxis != null)
                {
                    hashCode = hashCode * 59 + AAxis.GetHashCode();
                }

                if (BAxis != null)
                {
                    hashCode = hashCode * 59 + BAxis.GetHashCode();
                }

                if (CAxis != null)
                {
                    hashCode = hashCode * 59 + CAxis.GetHashCode();
                }

                if (UiRevision != null)
                {
                    hashCode = hashCode * 59 + UiRevision.GetHashCode();
                }

                return(hashCode);
            }
        }
Пример #11
0
    private void LoadBindings()
    {
        keyBindings.Clear();
        axisBindings.Clear();

        foreach (string name in Enum.GetNames(typeof(AKey)))
        {
            string  keyCode_str = OptionsManager.Instance.GetString(name + "_KeyBinding");
            KeyCode keyCode     = (KeyCode)Enum.Parse(typeof(KeyCode), keyCode_str);
            AKey    aKey        = (AKey)Enum.Parse(typeof(AKey), name);
            keyBindings.Add(aKey, keyCode);
        }

        foreach (string name in Enum.GetNames(typeof(AAxis)))
        {
            string axis_str = OptionsManager.Instance.GetString(name + "_AxisBinding");
            AAxis  aAxis    = (AAxis)Enum.Parse(typeof(AAxis), name);
            axisBindings.Add(aAxis, axis_str);
        }
    }
Пример #12
0
        /// <summary>
        /// Checks, which meta-visualization form would be appropriate
        /// for the given axes.
        ///
        /// For example the following MetaVis' are appropriate:
        ///
        /// | Axis constellation                                                | MetaVis                       |
        /// +-------------------------------------------------------------------+-------------------------------+
        /// | two arbitrarily constellated axes                                 | immersive axes                |
        /// | two arbitrarily constellated axes in the same layer               | FLA                           |
        /// | two orthogonal constellated numerical axes in the same layer      | scatterplot                   |
        /// | two orthogonal constellated categorical axes in the same layer    | height map / 3D bar chart     |
        /// </summary>
        /// <param name="axisA">first axis</param>
        /// <param name="axisB">second axis</param>
        /// <param name="dataSetID">data set ID of them</param>
        /// <returns>appropriate meta-visualization form</returns>
        public static MetaVisType WhichMetaVis(AxisPair axes, int dataSetID)
        {
            // Which MetaVis is defined by the implicit combination grammar?

            // ............................................ IMPLICIT GRAMMAR RULES

            // orthogonal case - 3 axes: scatterplot 3D
            // TODO - if enough time

            var constellation = new AAxis[] { axes.A, axes.B };

            if (MikadoIRuleScatterplot2D.I.RuleApplies(constellation))
            {
                return(MetaVisType.SCATTERPLOT_2D);
            }
            else if (MikadoIRuleHeatMap.I.RuleApplies(constellation))
            {
                return(MetaVisType.HEATMAP);
            }
            else
            {
                return(MetaVisType.IMMERSIVE_AXES);
            }
        }
Пример #13
0
    // ........................................................................ Template Method
    /// <summary>
    /// Template method. Defines the correct way to update meta-ETV.
    /// </summary>
    /// <param name="observable"></param>
    public void OnChange(AAxis observable)
    {
        try
        {
            if (observable == null || observable.gameObject == null)
            {
                return;
            }


            // Update meta-visualization, when spanning axes
            // change.
            if (!disposed && initialized)
            {
                UpdateVisibility();

                CheckValidity();
                if (valid)
                {
                    metaVisualization.UpdateETV();
                    TryHidingCloseAxes();
                    UpdatePosition();
                    UpdateSignedAngleBetweenAxes();
                    UpdateNormalVector();
                    UpdateRotation();
                }
                else
                {
                    Dispose();
                }
            }
        } catch (Exception e)
        {
            Debug.Log(e.Message + "Already destroyed");
        }
    }
Пример #14
0
 public void OnDispose(AAxis observable)
 {
     Dispose();
 }
Пример #15
0
 public abstract void OnDispose(AAxis observable);
Пример #16
0
 // ........................................................................ IAxisObserver
 public void Ignore(AAxis observable)
 {
     // Not neccessary, drestroys itself
     // when OnDispose() is called by observable.
 }
Пример #17
0
 public void Observe(AAxis observable)
 {
     observable.Subscribe(this);
 }
Пример #18
0
        public void Init(DataSet data, int[] nominalIDs, int[] ordinalIDs, int[] intervalIDs, int[] ratioIDs, AAxis axisA, AAxis axisB, bool isMetaVis = false)
        {
            base.Init(data, isMetaVis);
            this.pcpLineGenerator = new PCP3DLineGenerator();

            this.attributeA = axisA.attributeName;
            this.attributeB = axisB.attributeName;

            this.nominalIDs  = nominalIDs;
            this.ordinalIDs  = ordinalIDs;
            this.intervalIDs = intervalIDs;
            this.ratioIDs    = ratioIDs;

            axes = new Dictionary <string, AAxis>();
            axes.Add(axisA.attributeName, axisA);
            axes.Add(axisB.attributeName, axisB);
        }
Пример #19
0
 public float GetAxis(AAxis aAxis)
 {
     return(Input.GetAxis(axisBindings[aAxis]));
 }
 public override AETV CreateFlexiblePCP(DataSet data, string[] attIDs, AAxis axisA, AAxis axisB)
 {
     return(new ETV3DFlexiblePCP());
 }
 public override AETV CreateMetaFlexibleLinedAxes(DataSet data, string[] attIDs, AAxis axisA, AAxis axisB)
 {
     throw new System.NotImplementedException();
 }
 public override void OnDispose(AAxis observable)
 {
     // Do nothing
 }
 public override void OnChange(AAxis observable)
 {
     // Do nothing
 }
 public override void Ignore(AAxis observable)
 {
     // Do nothing
 }
 public override void Observe(AAxis observable)
 {
     // Do nothing
 }
Пример #26
0
        public static float ProjectedDistanceToAxis(Vector3 point, AAxis axis)
        {
            var ray = new Ray(axis.GetAxisBaseGlobal(), (axis.GetAxisTipGlobal() - axis.GetAxisBaseGlobal()));

            return(Vector3.Cross(ray.direction, point - ray.origin).magnitude);
        }
Пример #27
0
 // IAxisObserver
 public abstract void Observe(AAxis observable);
Пример #28
0
 public abstract void Ignore(AAxis observable);
Пример #29
0
 /// <inheritdoc />
 public override int GetHashCode()
 {
     unchecked // Overflow is fine, just wrap
     {
         var hashCode = 41;
         if (Type != null)
         {
             hashCode = hashCode * 59 + Type.GetHashCode();
         }
         if (Visible != null)
         {
             hashCode = hashCode * 59 + Visible.GetHashCode();
         }
         if (Opacity != null)
         {
             hashCode = hashCode * 59 + Opacity.GetHashCode();
         }
         if (Name != null)
         {
             hashCode = hashCode * 59 + Name.GetHashCode();
         }
         if (UId != null)
         {
             hashCode = hashCode * 59 + UId.GetHashCode();
         }
         if (Ids != null)
         {
             hashCode = hashCode * 59 + Ids.GetHashCode();
         }
         if (CustomData != null)
         {
             hashCode = hashCode * 59 + CustomData.GetHashCode();
         }
         if (Meta != null)
         {
             hashCode = hashCode * 59 + Meta.GetHashCode();
         }
         if (MetaArray != null)
         {
             hashCode = hashCode * 59 + MetaArray.GetHashCode();
         }
         if (Stream != null)
         {
             hashCode = hashCode * 59 + Stream.GetHashCode();
         }
         if (UiRevision != null)
         {
             hashCode = hashCode * 59 + UiRevision.GetHashCode();
         }
         if (_Carpet != null)
         {
             hashCode = hashCode * 59 + _Carpet.GetHashCode();
         }
         if (X != null)
         {
             hashCode = hashCode * 59 + X.GetHashCode();
         }
         if (Y != null)
         {
             hashCode = hashCode * 59 + Y.GetHashCode();
         }
         if (A != null)
         {
             hashCode = hashCode * 59 + A.GetHashCode();
         }
         if (A0 != null)
         {
             hashCode = hashCode * 59 + A0.GetHashCode();
         }
         if (DA != null)
         {
             hashCode = hashCode * 59 + DA.GetHashCode();
         }
         if (B != null)
         {
             hashCode = hashCode * 59 + B.GetHashCode();
         }
         if (B0 != null)
         {
             hashCode = hashCode * 59 + B0.GetHashCode();
         }
         if (Db != null)
         {
             hashCode = hashCode * 59 + Db.GetHashCode();
         }
         if (CheaterSlope != null)
         {
             hashCode = hashCode * 59 + CheaterSlope.GetHashCode();
         }
         if (AAxis != null)
         {
             hashCode = hashCode * 59 + AAxis.GetHashCode();
         }
         if (BAxis != null)
         {
             hashCode = hashCode * 59 + BAxis.GetHashCode();
         }
         if (Font != null)
         {
             hashCode = hashCode * 59 + Font.GetHashCode();
         }
         if (Color != null)
         {
             hashCode = hashCode * 59 + Color.GetHashCode();
         }
         if (XAxis != null)
         {
             hashCode = hashCode * 59 + XAxis.GetHashCode();
         }
         if (YAxis != null)
         {
             hashCode = hashCode * 59 + YAxis.GetHashCode();
         }
         if (IdsSrc != null)
         {
             hashCode = hashCode * 59 + IdsSrc.GetHashCode();
         }
         if (CustomDataSrc != null)
         {
             hashCode = hashCode * 59 + CustomDataSrc.GetHashCode();
         }
         if (MetaSrc != null)
         {
             hashCode = hashCode * 59 + MetaSrc.GetHashCode();
         }
         if (XSrc != null)
         {
             hashCode = hashCode * 59 + XSrc.GetHashCode();
         }
         if (YSrc != null)
         {
             hashCode = hashCode * 59 + YSrc.GetHashCode();
         }
         if (ASrc != null)
         {
             hashCode = hashCode * 59 + ASrc.GetHashCode();
         }
         if (BSrc != null)
         {
             hashCode = hashCode * 59 + BSrc.GetHashCode();
         }
         return(hashCode);
     }
 }
Пример #30
0
 public abstract void OnChange(AAxis observable);