CollectEvent(object sender, CollectorEventArgs e) { // cast the sender object to the SnoopCollector we are expecting Collector snoopCollector = sender as Collector; if (snoopCollector == null) { Debug.Assert(false); // why did someone else send us the message? return; } // see if it is a type we are responsible for ElementType sym = e.ObjToSnoop as ElementType; if (sym != null) { Stream(snoopCollector.Data(), sym); return; } RebarShapeDefinition rebarShapeDef = e.ObjToSnoop as RebarShapeDefinition; if (rebarShapeDef != null) { Stream(snoopCollector.Data(), rebarShapeDef); return; } RebarShapeSegment segment = e.ObjToSnoop as RebarShapeSegment; if (segment != null) { Stream(snoopCollector.Data(), segment); return; } RebarShapeConstraint segmentConstraint = e.ObjToSnoop as RebarShapeConstraint; if (segmentConstraint != null) { Stream(snoopCollector.Data(), segmentConstraint); return; } RebarShapeMultiplanarDefinition multiPlanarDef = e.ObjToSnoop as RebarShapeMultiplanarDefinition; if (multiPlanarDef != null) { Stream(snoopCollector.Data(), multiPlanarDef); return; } }
Stream(ArrayList data, RebarShapeConstraint constraint) { data.Add(new Snoop.Data.ClassSeparator(typeof(RebarShapeConstraint))); data.Add(new Snoop.Data.ElementId("Parameter ID ", constraint.GetParamId(), m_activeDoc)); RebarShapeConstraintSegmentLength rsc00 = constraint as RebarShapeConstraintSegmentLength; if (rsc00 != null) { Stream(data, rsc00); return; } RebarShapeConstraintFixedSegmentDir rsc01 = constraint as RebarShapeConstraintFixedSegmentDir; if (rsc01 != null) { Stream(data, rsc01); return; } RebarShapeConstraintProjectedSegmentLength rsc02 = constraint as RebarShapeConstraintProjectedSegmentLength; if (rsc02 != null) { Stream(data, rsc02); return; } RebarShapeConstraintCircumference rsc03 = constraint as RebarShapeConstraintCircumference; if (rsc03 != null) { Stream(data, rsc03); return; } RebarShapeConstraintRadius rsc04 = constraint as RebarShapeConstraintRadius; if (rsc04 != null) { Stream(data, rsc04); return; } RebarShapeConstraintArcLength rsc05 = constraint as RebarShapeConstraintArcLength; if (rsc05 != null) { Stream(data, rsc05); return; } RebarShapeConstraint180DegreeBendRadius rsc06 = constraint as RebarShapeConstraint180DegreeBendRadius; if (rsc06 != null) { Stream(data, rsc06); return; } }
private void Stream(ArrayList data, RebarShapeConstraint constraint) { data.Add(new Snoop.Data.ClassSeparator(typeof(RebarShapeConstraint))); data.Add(new Snoop.Data.ElementId("Parameter ID ", constraint.GetParamId(), m_activeDoc)); RebarShapeConstraintSegmentLength rsc00 = constraint as RebarShapeConstraintSegmentLength; if (rsc00 != null) { Stream(data, rsc00); return; } RebarShapeConstraintFixedSegmentDir rsc01 = constraint as RebarShapeConstraintFixedSegmentDir; if (rsc01 != null) { Stream(data, rsc01); return; } RebarShapeConstraintProjectedSegmentLength rsc02 = constraint as RebarShapeConstraintProjectedSegmentLength; if (rsc02 != null) { Stream(data, rsc02); return; } RebarShapeConstraintCircumference rsc03 = constraint as RebarShapeConstraintCircumference; if (rsc03 != null) { Stream(data, rsc03); return; } RebarShapeConstraintRadius rsc04 = constraint as RebarShapeConstraintRadius; if (rsc04 != null) { Stream(data, rsc04); return; } RebarShapeConstraintArcLength rsc05 = constraint as RebarShapeConstraintArcLength; if (rsc05 != null) { Stream(data, rsc05); return; } RebarShapeConstraint180DegreeBendRadius rsc06 = constraint as RebarShapeConstraint180DegreeBendRadius; if (rsc06 != null) { Stream(data, rsc06); return; } }