コード例 #1
0
ファイル: frontend.py プロジェクト: Rahulghuge94/ezdxf
 def draw_layout(
     self,
     layout: "Layout",
     finalize: bool = True,
     *,
     filter_func: FilterFunc = None,
     layout_properties: Optional[LayoutProperties] = None,
 ) -> None:
     if layout_properties is not None:
         self.ctx.current_layout_properties = layout_properties
     else:
         self.ctx.set_current_layout(layout)
     self.parent_stack = []
     handle_mapping = list(layout.get_redraw_order())
     if handle_mapping:
         self.draw_entities(
             reorder.ascending(layout, handle_mapping),
             filter_func=filter_func,
         )
     else:
         self.draw_entities(
             layout,
             filter_func=filter_func,
         )
     self.out.set_background(
         self.ctx.current_layout_properties.background_color)
     if finalize:
         self.out.finalize()
コード例 #2
0
def test_mapping_to_0_ascending_sort_order(entities):
    handles = [e.dxf.handle for e in reorder.ascending(entities, {"A": "0"})]
    assert handles == [
        "B",
        "C",
        "D",
        "A",
    ], 'Expected "A" mapped to "0" as last element'
コード例 #3
0
ファイル: frontend.py プロジェクト: ericgcc/ezdxf
 def draw_layout(self, layout: 'Layout', finalize: bool = True) -> None:
     self.parent_stack = []
     handle_mapping = list(layout.get_redraw_order())
     if handle_mapping:
         self.draw_entities(reorder.ascending(layout, handle_mapping))
     else:
         self.draw_entities(layout)
     self.out.set_background(self.ctx.current_layout.background_color)
     if finalize:
         self.out.finalize()
コード例 #4
0
def test_full_mapped_ascending_sort_order(entities):
    handles = [
        e.dxf.handle for e in reorder.ascending(entities, {
            'A': 'A',
            'B': 'A',
            'C': 'A',
            'D': 'A',
        })
    ]
    assert handles == ['A', 'D', 'B', 'C'], 'Expected the source entity order'
コード例 #5
0
def test_full_mapped_ascending_sort_order(entities):
    handles = [
        e.dxf.handle for e in reorder.ascending(
            entities,
            {
                "A": "A",
                "B": "A",
                "C": "A",
                "D": "A",
            },
        )
    ]
    assert handles == ["A", "D", "B", "C"], "Expected the source entity order"
コード例 #6
0
def test_mapping_to_0_ascending_sort_order(entities):
    handles = [e.dxf.handle for e in reorder.ascending(entities, {'A': '0'})]
    assert handles == ['B', 'C', 'D', 'A'], \
        'Expected "A" mapped to "0" as last element'
コード例 #7
0
def test_mapped_ascending_sort_order(entities):
    handles = [e.dxf.handle for e in reorder.ascending(entities, {'B': 'D'})]
    # B has the same sort handle as D and D & B should show up in source order
    assert handles == ['A', 'C', 'D', 'B']
コード例 #8
0
def test_ascending_sort_order(entities):
    handles = [e.dxf.handle for e in reorder.ascending(entities)]
    assert handles == ['A', 'B', 'C', 'D']
コード例 #9
0
def test_mapped_ascending_sort_order(entities):
    handles = [e.dxf.handle for e in reorder.ascending(entities, {"B": "D"})]
    # B has the same sort handle as D and D & B should show up in source order
    assert handles == ["A", "C", "D", "B"]
コード例 #10
0
def test_ascending_sort_order(entities):
    handles = [e.dxf.handle for e in reorder.ascending(entities)]
    assert handles == ["A", "B", "C", "D"]