GlowQualifiedMatrix ConvertQualifiedMatrix(XElement xml)
        {
            var glow = new GlowQualifiedMatrix(ConvertPath(xml.Attribute("path").Value));

            FillMatrix(glow, xml);
            return(glow);
        }
        object IGlowVisitor <XmlWriter, object> .Visit(GlowQualifiedMatrix glow, XmlWriter state)
        {
            state.WriteStartElement("QualifiedMatrix");
            state.WriteAttributeString("path", ConvertPath(glow.Path));

            ConvertMatrix(glow, state);

            state.WriteEndElement();
            return(null);
        }
예제 #3
0
        bool IGlowVisitor <object, bool> .Visit(GlowQualifiedMatrix glow, object state)
        {
            if (_onMatrix != null)
            {
                _onMatrix(glow);
                return(true);
            }

            return(false);
        }
        GlowMatrixBase MatrixToGlow(Matrix matrix, ElementToGlowOptions options)
        {
            var dirFieldMask = options.DirFieldMask;
            var glow         = new GlowQualifiedMatrix(matrix.Path)
            {
                Identifier  = matrix.Identifier,
                TargetCount = matrix.TargetCount,
                SourceCount = matrix.SourceCount,
            };

            if (dirFieldMask.HasBits(GlowFieldFlags.Description) &&
                String.IsNullOrEmpty(matrix.Description) == false)
            {
                glow.Description = matrix.Description;
            }

            if (matrix.LabelsNode != null &&
                dirFieldMask == GlowFieldFlags.All)
            {
                var labels = new EmberSequence(GlowTags.MatrixContents.Labels);
                labels.Insert(new GlowLabel {
                    BasePath = matrix.LabelsNode.Path, Description = "Primary"
                });
                glow.Labels = labels;
            }

            if (dirFieldMask.HasBits(GlowFieldFlags.Connections) &&
                options.IsCompleteMatrixEnquired)
            {
                var glowConnections = glow.EnsureConnections();

                foreach (var signal in matrix.Targets)
                {
                    var glowConnection = new GlowConnection(signal.Number);

                    if (signal.ConnectedSources.Any())
                    {
                        glowConnection.Sources = signal.ConnectedSources.Select(source => source.Number).ToArray();
                    }

                    glowConnections.Insert(glowConnection);
                }
            }

            if ((dirFieldMask == GlowFieldFlags.All) &&
                String.IsNullOrEmpty(matrix.SchemaIdentifier) == false)
            {
                glow.SchemaIdentifiers = matrix.SchemaIdentifier;
            }

            return(glow);
        }
예제 #5
0
            public GlowContainer Visit(GlowQualifiedMatrix glow, object state)
            {
                var newPath      = PrependPathWithEndPointNumber(glow.Path);
                var newQualified = new GlowQualifiedMatrix(newPath);

                foreach (var ember in glow)
                {
                    if (ember.Tag != GlowTags.QualifiedMatrix.Path)
                    {
                        newQualified.Insert(ember);
                    }
                }

                return(newQualified);
            }
예제 #6
0
            public IEnumerable <GlowContainer> Visit(GlowQualifiedMatrix glow, object state)
            {
                EndPointNumber = glow.Path[0];

                var newPath      = glow.Path.Skip(1).ToArray();
                var newQualified = new GlowQualifiedMatrix(newPath);

                foreach (var ember in glow)
                {
                    if (ember.Tag != GlowTags.QualifiedMatrix.Path)
                    {
                        newQualified.Insert(ember);
                    }
                }

                yield return(newQualified);
            }
        public void NotifyMatrixConnection(Matrix matrix, Signal target, object state)
        {
            var glow           = GlowRootElementCollection.CreateRoot();
            var glowMatrix     = new GlowQualifiedMatrix(matrix.Path);
            var glowConnection = new GlowConnection(target.Number)
            {
                Sources     = target.ConnectedSources.Select(signal => signal.Number).ToArray(),
                Disposition = GlowConnectionDisposition.Modified,
            };

            glowMatrix.EnsureConnections().Insert(glowConnection);

            glow.Insert(glowMatrix);

            OnGlowRootReady(new GlowRootReadyArgs(glow, null)
            {
                Matrix = matrix
            });
        }
예제 #8
0
파일: Model.cs 프로젝트: scy/ember-plus
 bool IGlowVisitor <object, bool> .Visit(GlowQualifiedMatrix glow, object state)
 {
     return(false);
 }
예제 #9
0
 GlowQualifiedMatrix ConvertQualifiedMatrix(XElement xml)
 {
     var glow = new GlowQualifiedMatrix(ConvertPath(xml.Attribute("path").Value));
      FillMatrix(glow, xml);
      return glow;
 }