/// <summary> /// Sets a potential attachment /// </summary> internal void SetAttachmentCandidate(Collection <FeatureTargetGeometry> targetGeometryCollection) { if (IsAttachPossible) { FeatureTargetGeometry newTo = null; // Set the target geometry from the full collection of candidates var attachCandidate = targetGeometryCollection != null && targetGeometryCollection.Count == 1 ? targetGeometryCollection[0] : null; if (attachCandidate != null) { var candidateTables = TableDescriptor.CandidateTableDescriptorsForAttach(); if (candidateTables != null) { foreach (var attach in candidateTables) { if (attachCandidate.Feature.TableDescriptor.Name == attach.Name) { newTo = attachCandidate; } } } } AttachTo = newTo; CalculateState(); } }
/// <summary> /// Can we attach to the specified table descriptor /// </summary> internal bool CanAttachTo(FeatureTableDescriptor table) { bool canAttach = false; if (IsAttachPossible) { var candidateTables = TableDescriptor.CandidateTableDescriptorsForAttach(); if (candidateTables != null) { foreach (var attach in candidateTables) { if (table.Name == attach.Name) { canAttach = true; break; } } } } return(canAttach); }