[][src]Struct oox::shared::drawingml::shapedefs::GeomGuide

pub struct GeomGuide {
    pub name: GeomGuideName,
    pub formula: GeomGuideFormula,
}

This element specifies the precense of a shape guide that is used to govern the geometry of the specified shape. A shape guide consists of a formula and a name that the result of the formula is assigned to. Recognized formulas are listed with the fmla attribute documentation for this element.

Note

The order in which guides are specified determines the order in which their values are calculated. For instance it is not possible to specify a guide that uses another guides result when that guide has not yet been calculated.

Example

Consider the case where the user would like to specify a triangle with it's bottom edge defined not by static points but by using a varying parameter, namely an guide. Consider the diagrams and DrawingML shown below. This first triangle has been drawn with a bottom edge that is equal to the 2/3 the value of the shape height. Thus we see in the figure below that the triangle appears to occupy 2/3 of the vertical space within the shape bounding box.

<a:xfrm>
  <a:off x="3200400" y="1600200"/>
  <a:ext cx="1705233" cy="679622"/>
</a:xfrm>
<a:custGeom>
  <a:avLst/>
  <a:gdLst>
    <a:gd name="myGuide" fmla="*/ h 2 3"/>
  </a:gdLst>
  <a:ahLst/>
  <a:cxnLst/>
  <a:rect l="0" t="0" r="0" b="0"/>
  <a:pathLst>
    <a:path w="1705233" h="679622">
      <a:moveTo>
        <a:pt x="0" y="myGuide"/>
      </a:moveTo>
      <a:lnTo>
        <a:pt x="1705233" y="myGuide"/>
      </a:lnTo>
      <a:lnTo>
        <a:pt x="852616" y="0"/>
      </a:lnTo>
      <a:close/>
    </a:path>
  </a:pathLst>
</a:custGeom>

If however we change the guide to half that, namely 1/3. Then we see the entire bottom edge of the triangle move to now only occupy 1/3 of the toal space within the shape bounding box. This is because both of the bottom points in this triangle depend on this guide for their coordinate positions.

<a:gdLst>
  <a:gd name="myGuide" fmla="*/ h 1 3"/>
</a:gdLst>

Fields

name: GeomGuideName

Specifies the name that is used to reference to this guide. This name can be used just as a variable would within an equation. That is this name can be substituted for literal values within other guides or the specification of the shape path.

formula: GeomGuideFormula

Specifies the formula that is used to calculate the value for a guide. Each formula has a certain number of arguments and a specific set of operations to perform on these arguments in order to generate a value for a guide. There are a total of 17 different formulas available. These are shown below with the usage for each defined.

  • ('*/') - Multiply Divide Formula

    Arguments: 3 (fmla="*/ x y z")

    Usage: "*/ x y z" = ((x * y) / z) = value of this guide

  • ('+-') - Add Subtract Formula

    Arguments: 3 (fmla="+- x y z")

    Usage: "+- x y z" = ((x + y) - z) = value of this guide

  • ('+/') - Add Divide Formula

    Arguments: 3 (fmla="+/ x y z")

    Usage: "+/ x y z" = ((x + y) / z) = value of this guide

  • ('?:') - If Else Formula

    Arguments: 3 (fmla="?: x y z")

    Usage: "?: x y z" = if (x > 0), then y = value of this guide,
    else z = value of this guide

  • ('abs') - Absolute Value Formula

    Arguments: 1 (fmla="abs x")

    Usage: "abs x" = if (x < 0), then (-1) * x = value of this guide
    else x = value of this guide

  • ('at2') - ArcTan Formula

    Arguments: 2 (fmla="at2 x y")

    Usage: "at2 x y" = arctan(y / x) = value of this guide

  • ('cat2') - Cosine ArcTan Formula

    Arguments: 3 (fmla="cat2 x y z")

    Usage: "cat2 x y z" = (x*(cos(arctan(z / y))) = value of this guide

  • ('cos') - Cosine Formula

    Arguments: 2 (fmla="cos x y")

    Usage: "cos x y" = (x * cos( y )) = value of this guide

  • ('max') - Maximum Value Formula

    Arguments: 2 (fmla="max x y")

    Usage: "max x y" = if (x > y), then x = value of this guide
    else y = value of this guide

  • ('min') - Minimum Value Formula

    Arguments: 2 (fmla="min x y")

    Usage: "min x y" = if (x < y), then x = value of this guide
    else y = value of this guide

  • ('mod') - Modulo Formula

    Arguments: 3 (fmla="mod x y z")

    Usage: "mod x y z" = sqrt(x^2 + b^2 + c^2) = value of this guide

  • ('pin') - Pin To Formula

    Arguments: 3 (fmla="pin x y z")

    Usage: "pin x y z" = if (y < x), then x = value of this guide
    else if (y > z), then z = value of this guide
    else y = value of this guide

  • ('sat2') - Sine ArcTan Formula

    Arguments: 3 (fmla="sat2 x y z")

    Usage: "sat2 x y z" = (x*sin(arctan(z / y))) = value of this guide

  • ('sin') - Sine Formula

    Arguments: 2 (fmla="sin x y")

    Usage: "sin x y" = (x * sin( y )) = value of this guide

  • ('sqrt') - Square Root Formula

    Arguments: 1 (fmla="sqrt x")

    Usage: "sqrt x" = sqrt(x) = value of this guide

  • ('tan') - Tangent Formula

    Arguments: 2 (fmla="tan x y")

    Usage: "tan x y" = (x * tan( y )) = value of this guide

  • ('val') - Literal Value Formula

    Arguments: 1 (fmla="val x")

    Usage: "val x" = x = value of this guide

Note

Guides that have a literal value formula specified via fmla="val x" above should only be used within the avLst as an adjust value for the shape. This however is not strictly enforced.

Methods

impl GeomGuide[src]

pub fn from_xml_element(xml_node: &XmlNode) -> Result<Self>[src]

Trait Implementations

impl Clone for GeomGuide[src]

impl Debug for GeomGuide[src]

impl PartialEq<GeomGuide> for GeomGuide[src]

impl StructuralPartialEq for GeomGuide[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.