Macaulay2 » Documentation
Packages » Graphics :: mergeFormattedGraphicPrimitives(FormattedGraphicPrimitives,FormattedGraphicPrimitives)
next | previous | forward | backward | up | index | toc

# mergeFormattedGraphicPrimitives(FormattedGraphicPrimitives,FormattedGraphicPrimitives) -- merge two lists of graphic primitives with options

- Function: mergeFormattedGraphicPrimitives
- Usage:
    `mergeFormattedGraphicPrimitives(fgp1,fgp2)`
- Inputs:
  - fgp1, an instance of the type FormattedGraphicPrimitives,
  - fgp2, an instance of the type FormattedGraphicPrimitives,
- Optional inputs:
  - keep
  - priority
- Outputs:
  - an instance of the type FormattedGraphicPrimitives,

## Description

The list of graphic primitives are concatenated and the graphic options are merged according to the value of two options "keep" (either "1or2", "1" or "2") and "priority" (either "1" or "2").

    i1 : myoptions1= new HashTable from {"fill"=>"black"}

    o1 = HashTable{"fill" => black}

    o1 : HashTable

    i2 : myoptions2= new HashTable from {"fill"=>"blue","stroke"=>"red"}

    o2 = HashTable{"fill" => blue }
                   "stroke" => red

    o2 : HashTable

    i3 : fgp1=formatGraphicPrimitives({point(20,30),point(40,50)},myoptions1)

    o3 = FormattedGraphicPrimitives{{Point2D{20, 30}, Point2D{40, 50}}, HashTable{"fill" => black}}

    o3 : FormattedGraphicPrimitives

    i4 : fgp2=formatGraphicPrimitives({circle(point(30,40),10)},myoptions2)

    o4 = FormattedGraphicPrimitives{{Circle{Point2D{30, 40}, 10}}, HashTable{"fill" => blue }}
                                                                             "stroke" => red

    o4 : FormattedGraphicPrimitives

    i5 : mergeFormattedGraphicPrimitives(fgp1,fgp2)

    o5 = FormattedGraphicPrimitives{{Point2D{20, 30}, Point2D{40, 50}, Circle{Point2D{30, 40}, 10}}, HashTable{"fill" => black}}

    o5 : FormattedGraphicPrimitives

    i6 : mergeFormattedGraphicPrimitives(fgp1,fgp2,"keep"=>"2","priority"=>"1")

    o6 = FormattedGraphicPrimitives{{Point2D{20, 30}, Point2D{40, 50}, Circle{Point2D{30, 40}, 10}}, HashTable{"fill" => black}}
                                                                                                               "stroke" => red

    o6 : FormattedGraphicPrimitives

## Ways to use this method:

- mergeFormattedGraphicPrimitives(FormattedGraphicPrimitives,FormattedGraphicPrimitives) -- merge two lists of graphic primitives with options

The source of this document is in /build/macaulay2-88fgJW/macaulay2-1.25.11+ds/M2/Macaulay2/packages/Graphics.m2:1265:0.