public ImpositionTool(IEntityContainer container)
        {
            _initialEntities = container;

            using (PicFactory factory = new PicFactory(container))
            {
                // compute lengthes
                PicVisitorDieCutLength visitor = new PicVisitorDieCutLength();
                factory.ProcessVisitor(visitor);
                Dictionary <PicGraphics.LT, double> lengthes = visitor.Lengths;
                _unitLengthCut  = lengthes.ContainsKey(PicGraphics.LT.LT_CUT) ? visitor.Lengths[PicGraphics.LT.LT_CUT] : 0.0;
                _unitLengthFold = lengthes.ContainsKey(PicGraphics.LT.LT_CREASING) ? visitor.Lengths[PicGraphics.LT.LT_CREASING] : 0.0;
                // compute area
                try
                {
                    PicToolArea picToolArea = new PicToolArea();
                    factory.ProcessTool(picToolArea);
                    _unitArea = picToolArea.Area;
                }
                catch (PicToolTooLongException /*ex*/)
                {
                    _unitArea = 0;
                }
            }
        }
Exemplo n.º 2
0
 public void Dimensions(ParameterStack stack, out double width, out double height, out double lengthCut, out double lengthFold)
 {
     // build factory
     Pic.Factory2D.PicFactory factory = new Pic.Factory2D.PicFactory();
     _component.CreateFactoryEntities(factory, stack);
     if (_reflexionX)
     {
         factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
     }
     if (_reflexionY)
     {
         factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));
     }
     // get bounding box
     Pic.Factory2D.PicVisitorBoundingBox visitorBoundingBox = new Pic.Factory2D.PicVisitorBoundingBox();
     factory.ProcessVisitor(visitorBoundingBox, _showCotations ? PicFilter.FilterNone : !PicFilter.FilterCotation);
     Pic.Factory2D.Box2D box = visitorBoundingBox.Box;
     width  = box.Width;
     height = box.Height;
     // get length
     Pic.Factory2D.PicVisitorDieCutLength visitorLength = new Pic.Factory2D.PicVisitorDieCutLength();
     factory.ProcessVisitor(visitorLength, PicFilter.FilterNone);
     lengthCut  = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CUT) ? visitorLength.Lengths[PicGraphics.LT.LT_CUT] : 0.0;
     lengthFold = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CREASING) ? visitorLength.Lengths[PicGraphics.LT.LT_CREASING] : 0.0;
 }
Exemplo n.º 3
0
 public void Dimensions(ParameterStack stack, out double width, out double height, out double lengthCut, out double lengthFold)
 { 
     // build factory
     Pic.Factory2D.PicFactory factory = new Pic.Factory2D.PicFactory();
     _component.CreateFactoryEntities(factory, stack);
     if (_reflexionX) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionX));
     if (_reflexionY) factory.ProcessVisitor(new PicVisitorTransform(Transform2D.ReflectionY));
     // get bounding box
     Pic.Factory2D.PicVisitorBoundingBox visitorBoundingBox = new Pic.Factory2D.PicVisitorBoundingBox();
     factory.ProcessVisitor(visitorBoundingBox, _showCotations ? PicFilter.FilterNone : PicFilter.FilterCotation);
     Pic.Factory2D.Box2D box = visitorBoundingBox.Box;
     width = box.Width;
     height = box.Height;
     // get length
     Pic.Factory2D.PicVisitorDieCutLength visitorLength = new Pic.Factory2D.PicVisitorDieCutLength();
     factory.ProcessVisitor(visitorLength, PicFilter.FilterNone);
     lengthCut = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CUT) ? visitorLength.Lengths[PicGraphics.LT.LT_CUT] : 0.0;
     lengthFold = visitorLength.Lengths.ContainsKey(PicGraphics.LT.LT_CREASING) ? visitorLength.Lengths[PicGraphics.LT.LT_CREASING] : 0.0;
 }