public TagLeader(IndependentTag tag, Document doc) { this._doc = doc; this._currentView = this._doc.GetElement(((Element)tag).get_OwnerViewId()) as View; this._tag = tag; this._taggedElement = TagLeader.GetTaggedElement(this._doc, this._tag); this._tagHeadPosition = this._currentView.get_CropBox().get_Transform().get_Inverse().OfPoint(tag.get_TagHeadPosition()); this._tagHeadPosition = new XYZ(this._tagHeadPosition.get_X(), this._tagHeadPosition.get_Y(), 0.0); this._leaderEnd = TagLeader.GetLeaderEnd(this._taggedElement, this._currentView); this._side = XYZ.op_Division(XYZ.op_Addition(this._currentView.get_CropBox().get_Max(), this._currentView.get_CropBox().get_Min()), 2.0).get_X() <= this._leaderEnd.get_X() ? ViewSides.Right : ViewSides.Left; this.GetTagDimension(); }
private List <XYZ> CreateTagPositionPoints(View activeView, List <TagLeader> tagLeaders, ViewSides side) { List <XYZ> xyzList = new List <XYZ>(); BoundingBoxXYZ cropBox = activeView.get_CropBox(); if ((uint)tagLeaders.Count > 0U) { double num1 = tagLeaders.Max <TagLeader>((Func <TagLeader, double>)(x => x.TagHeight)); tagLeaders.Max <TagLeader>((Func <TagLeader, double>)(x => x.TagWidth)); double num2 = num1 * 1.2; int num3 = (int)Math.Round((cropBox.get_Max().get_Y() - cropBox.get_Min().get_Y()) / num2); XYZ xyz1 = new XYZ(cropBox.get_Max().get_X(), cropBox.get_Min().get_Y(), 0.0); XYZ xyz2 = new XYZ(cropBox.get_Min().get_X(), cropBox.get_Min().get_Y(), 0.0); for (int index = num3 * 2; index > 0; --index) { if (side == ViewSides.Left) { xyzList.Add(XYZ.op_Addition(xyz2, new XYZ(0.0, num2 * (double)index, 0.0))); } else { xyzList.Add(XYZ.op_Addition(xyz1, new XYZ(0.0, num2 * (double)index, 0.0))); } } } return(xyzList); }
private List <XYZ> CreateTagPositionPoints(View activeView, List <TagLeader> tagLeaders, ViewSides side) { List <XYZ> points = new List <XYZ>(); BoundingBoxXYZ bbox = activeView.CropBox; if (tagLeaders.Count != 0) { //Get largest tag dimension double tagHeight = tagLeaders.Max(x => x.TagHeight); double tagWidth = tagLeaders.Max(x => x.TagWidth); double step = tagHeight * 1.2; //double step = (bbox.Max.Y - bbox.Min.Y) / 20; int max = (int)Math.Round((bbox.Max.Y - bbox.Min.Y) / step); XYZ baseRight = new XYZ(bbox.Max.X, bbox.Min.Y, 0); XYZ baseLeft = new XYZ(bbox.Min.X, bbox.Min.Y, 0); //create sides points for (int i = max * 2; i > 0; i--) { if (side == ViewSides.Left) { //Add left point points.Add(baseLeft + new XYZ(0, step * i, 0)); } else { //Add right point points.Add(baseRight + new XYZ(0, step * i, 0)); } } } return(points); }