예제 #1
0
 /// <summary>
 ///     Determines if this instance of <see cref="User" /> is also a contact for an organization.  Users are considered a
 ///     contact if any of the fields typically associated with a Contact record are present.
 /// </summary>
 public bool IsUserAlsoContact()
 {
     return(AssociatedEntities != null && AssociatedEntities.Any() ||
            ContactTypes != null && ContactTypes.Any() ||
            !string.IsNullOrEmpty(PrimaryPhoneNumber) ||
            !string.IsNullOrEmpty(MobilePhoneNumber) ||
            !string.IsNullOrEmpty(Title) ||
            PhysicalAddress != null && !PhysicalAddress.IsEmpty());
 }
예제 #2
0
 /// <summary>
 /// Re-orders the list of AssociatedEntities based on their current z-index
 /// </summary>
 protected override void PreProcess()
 {
     _drawn = 0;
     // Re-order based on z
     AssociatedEntities = AssociatedEntities.OrderBy(
         entity => entity.GetComponent <SpriteTransform>().Z
         ).ToList();
     // Update the current frames camera position
     _cameraRect = MBGame.Camera.BoundingRectangle;
 }
 public virtual void RemoveAssociation(SimpleAssociatedEntity association)
 {
     if (AssociatedEntities.Contains(association))
     {
         association.UnbindFromCurrentOwner();
     }
     else
     {
         throw new ArgumentException("SimpleAssociatedEntity [" + association + "] not currently bound to this [" + this + "]");
     }
 }
예제 #4
0
        internal void ReadCommonPointers(List <string> parameters, int nextIndex, IgesReaderBinder binder)
        {
            var associatedPointerCount = Integer(parameters, nextIndex++);

            for (int i = 0; i < associatedPointerCount; i++)
            {
                binder.BindEntity(Integer(parameters, nextIndex++), e =>
                {
                    if (e != null)
                    {
                        Debug.Assert(e.EntityType == IgesEntityType.AssociativityInstance || e.EntityType == IgesEntityType.GeneralNote || e.EntityType == IgesEntityType.TextDisplayTemplate);
                        AssociatedEntities.Add(e);
                    }
                });
            }

            var propertyPointerCount = Integer(parameters, nextIndex++);

            for (int i = 0; i < propertyPointerCount; i++)
            {
                binder.BindEntity(Integer(parameters, nextIndex++), e => Properties.Add(e));
            }
        }
예제 #5
0
        internal int AddDirectoryAndParameterLines(WriterState writerState)
        {
            OnBeforeWrite();
            writerState.ReportReferencedEntities(GetReferencedEntities());

            // write structure entity (field 3)
            if (StructureEntity != null)
            {
                _structurePointer = -writerState.GetOrWriteEntityIndex(StructureEntity);
            }
            else
            {
                _structurePointer = 0;
            }

            // write line font pattern (field 4)
            int lineFontPattern = 0;

            if (CustomLineFont != null)
            {
                lineFontPattern = -writerState.GetOrWriteEntityIndex(CustomLineFont);
            }
            else
            {
                lineFontPattern = (int)LineFont;
            }

            // write levels (field 5)
            if (Levels.Count <= 1)
            {
                _levelsPointer = Levels.FirstOrDefault();
            }
            else
            {
                _levelsPointer = -writerState.GetLevelsPointer(Levels);
            }

            // write view (field 6)
            if (View != null)
            {
                _viewPointer = writerState.GetOrWriteEntityIndex(View);
            }
            else
            {
                _viewPointer = 0;
            }

            // write transformation matrix (field 7)
            if (TransformationMatrix != null && !TransformationMatrix.IsIdentity)
            {
                _transformationMatrixPointer = writerState.GetOrWriteEntityIndex(TransformationMatrix);
            }
            else
            {
                _transformationMatrixPointer = 0;
            }

            // write label display associativity (field 8)
            if (LabelDisplay != null)
            {
                _labelDisplayPointer = writerState.GetOrWriteEntityIndex(LabelDisplay);
            }
            else
            {
                _labelDisplayPointer = 0;
            }

            // write custom color entity (field 13)
            int color = 0;

            if (CustomColor != null)
            {
                color = -writerState.GetOrWriteEntityIndex(CustomColor);
            }
            else
            {
                color = (int)Color;
            }

            var parameters = new List <object>();

            parameters.Add((int)EntityType);
            this.WriteParameters(parameters, writerState.WriterBinder);

            if (AssociatedEntities.Any() || Properties.Any())
            {
                writerState.ReportReferencedEntities(AssociatedEntities);
                writerState.ReportReferencedEntities(Properties);
                parameters.Add(AssociatedEntities.Count);
                parameters.AddRange(AssociatedEntities.Select(writerState.WriterBinder.GetEntityId).Cast <object>());

                if (Properties.Any())
                {
                    parameters.Add(Properties.Count);
                    parameters.AddRange(Properties.Select(writerState.WriterBinder.GetEntityId).Cast <object>());
                }
            }

            var nextDirectoryIndex = writerState.DirectoryLines.Count + 1;
            var nextParameterIndex = writerState.ParameterLines.Count + 1;

            this._lineCount = IgesFileWriter.AddParametersToStringList(parameters.ToArray(), writerState.ParameterLines, writerState.FieldDelimiter, writerState.RecordDelimiter,
                                                                       lineSuffix: string.Format(" {0,7}", nextDirectoryIndex),
                                                                       comment: Comment);
            var dir = GetDirectoryData(color, lineFontPattern);

            dir.ParameterPointer = nextParameterIndex;
            dir.ToString(writerState.DirectoryLines);

            writerState.EntityMap[this] = nextDirectoryIndex;

            return(nextDirectoryIndex);
        }