#[non_exhaustive]pub enum Control {
Show 20 variants
TextBox {
paragraphs: Vec<Paragraph>,
width: HwpUnit,
height: HwpUnit,
horz_offset: i32,
vert_offset: i32,
caption: Option<Caption>,
style: Option<ShapeStyle>,
},
Hyperlink {
text: String,
url: String,
},
Footnote {
inst_id: Option<u32>,
paragraphs: Vec<Paragraph>,
},
Endnote {
inst_id: Option<u32>,
paragraphs: Vec<Paragraph>,
},
Line {
start: ShapePoint,
end: ShapePoint,
width: HwpUnit,
height: HwpUnit,
horz_offset: i32,
vert_offset: i32,
caption: Option<Caption>,
style: Option<ShapeStyle>,
},
Ellipse {
center: ShapePoint,
axis1: ShapePoint,
axis2: ShapePoint,
width: HwpUnit,
height: HwpUnit,
horz_offset: i32,
vert_offset: i32,
paragraphs: Vec<Paragraph>,
caption: Option<Caption>,
style: Option<ShapeStyle>,
},
Polygon {
vertices: Vec<ShapePoint>,
width: HwpUnit,
height: HwpUnit,
horz_offset: i32,
vert_offset: i32,
paragraphs: Vec<Paragraph>,
caption: Option<Caption>,
style: Option<ShapeStyle>,
},
Equation {
script: String,
width: HwpUnit,
height: HwpUnit,
base_line: u32,
text_color: Color,
font: String,
},
Chart {Show 16 fields
chart_type: ChartType,
data: ChartData,
width: HwpUnit,
height: HwpUnit,
title: Option<String>,
legend: LegendPosition,
grouping: ChartGrouping,
bar_shape: Option<BarShape>,
explosion: Option<u32>,
of_pie_type: Option<OfPieType>,
radar_style: Option<RadarStyle>,
wireframe: Option<bool>,
bubble_3d: Option<bool>,
scatter_style: Option<ScatterStyle>,
show_markers: Option<bool>,
stock_variant: Option<StockVariant>,
},
Dutmal {
main_text: String,
sub_text: String,
position: DutmalPosition,
sz_ratio: u32,
align: DutmalAlign,
},
Compose {
compose_text: String,
circle_type: String,
char_sz: i32,
compose_type: String,
},
Arc {Show 14 fields
arc_type: ArcType,
center: ShapePoint,
axis1: ShapePoint,
axis2: ShapePoint,
start1: ShapePoint,
end1: ShapePoint,
start2: ShapePoint,
end2: ShapePoint,
width: HwpUnit,
height: HwpUnit,
horz_offset: i32,
vert_offset: i32,
caption: Option<Caption>,
style: Option<ShapeStyle>,
},
Curve {
points: Vec<ShapePoint>,
segment_types: Vec<CurveSegmentType>,
width: HwpUnit,
height: HwpUnit,
horz_offset: i32,
vert_offset: i32,
caption: Option<Caption>,
style: Option<ShapeStyle>,
},
ConnectLine {
start: ShapePoint,
end: ShapePoint,
control_points: Vec<ShapePoint>,
connect_type: String,
width: HwpUnit,
height: HwpUnit,
horz_offset: i32,
vert_offset: i32,
caption: Option<Caption>,
style: Option<ShapeStyle>,
},
Bookmark {
name: String,
bookmark_type: BookmarkType,
},
CrossRef {
target_name: String,
ref_type: RefType,
content_type: RefContentType,
as_hyperlink: bool,
},
Field {
field_type: FieldType,
hint_text: Option<String>,
help_text: Option<String>,
},
Memo {
content: Vec<Paragraph>,
author: String,
date: String,
},
IndexMark {
primary: String,
secondary: Option<String>,
},
Unknown {
tag: String,
data: Option<String>,
},
}Expand description
An inline control element.
Controls are non-text elements that appear within a Run.
Each variant carries its own data; the enum is #[non_exhaustive]
for forward compatibility.
§Examples
use hwpforge_core::control::Control;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let text_box = Control::TextBox {
paragraphs: vec![Paragraph::new(ParaShapeIndex::new(0))],
width: HwpUnit::from_mm(80.0).unwrap(),
height: HwpUnit::from_mm(40.0).unwrap(),
horz_offset: 0,
vert_offset: 0,
caption: None,
style: None,
};
assert!(text_box.is_text_box());
assert!(!text_box.is_hyperlink());Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
TextBox
An inline text box with its own paragraph content.
Maps to HWPX <hp:rect> + <hp:drawText> (drawing object, not control).
Fields
style: Option<ShapeStyle>Optional visual style overrides (border color, fill, line width).
Hyperlink
A hyperlink with display text and URL.
Footnote
A footnote containing paragraph content.
Maps to HWPX <hp:ctrl><hp:footNote>.
Fields
Endnote
An endnote containing paragraph content.
Maps to HWPX <hp:ctrl><hp:endNote>.
Fields
Line
A line drawing object (2 endpoints).
Maps to HWPX <hp:line>.
Fields
start: ShapePointStart point (x, y in HWPUNIT).
end: ShapePointEnd point (x, y in HWPUNIT).
style: Option<ShapeStyle>Optional visual style overrides (border color, fill, line width).
Ellipse
An ellipse (or circle) drawing object.
Maps to HWPX <hp:ellipse>.
Fields
center: ShapePointCenter point (x, y in HWPUNIT).
axis1: ShapePointAxis 1 endpoint (defines semi-major axis direction and length).
axis2: ShapePointAxis 2 endpoint (perpendicular to axis1, defines semi-minor axis).
style: Option<ShapeStyle>Optional visual style overrides (border color, fill, line width).
Polygon
A polygon drawing object (3+ vertices).
Maps to HWPX <hp:polygon>.
Fields
vertices: Vec<ShapePoint>Ordered list of vertices (minimum 3).
style: Option<ShapeStyle>Optional visual style overrides (border color, fill, line width).
Equation
An inline equation (수식) using HancomEQN script format.
Maps to HWPX <hp:equation> with <hp:script> child.
Equations have NO shape common block (no offset, orgSz, curSz, flip, rotation, lineShape, fillBrush, shadow). Only sz + pos + outMargin + script.
Fields
Chart
An OOXML chart embedded in the document.
Maps to HWPX <hp:switch><hp:case><hp:chart> with separate Chart XML file.
Charts have NO shape common block (like Equation): only sz + pos + outMargin.
Fields
legend: LegendPositionLegend position.
grouping: ChartGroupingSeries grouping mode.
explosion: Option<u32>Exploded pie/doughnut percentage (None = not exploded, Some(25) = 25% explosion).
radar_style: Option<RadarStyle>Radar chart rendering style (None = default Standard).
scatter_style: Option<ScatterStyle>Scatter chart style (None = default Dots).
stock_variant: Option<StockVariant>Stock chart sub-variant (None = default HLC, 3 series).
VHLC and VOHLC generate a composite <c:plotArea> with both
<c:barChart> (volume) and <c:stockChart> (price) elements.
Dutmal
Dutmal (덧말): annotation text displayed above or below main text.
Maps to HWPX <hp:dutmal>.
Fields
position: DutmalPositionPosition of the annotation relative to main text.
align: DutmalAlignAlignment of the annotation text.
Compose
Compose (글자겹침): overlaid/combined characters.
Maps to HWPX <hp:compose>.
Fields
Arc
An arc (partial ellipse) drawing object.
Maps to HWPX <hp:ellipse> with hasArcPr="1".
Fields
center: ShapePointCenter point of the parent ellipse.
axis1: ShapePointAxis 1 endpoint (semi-major axis).
axis2: ShapePointAxis 2 endpoint (semi-minor axis).
start1: ShapePointArc start point 1.
end1: ShapePointArc end point 1.
start2: ShapePointArc start point 2.
end2: ShapePointArc end point 2.
style: Option<ShapeStyle>Optional visual style overrides.
Curve
A curve drawing object (bezier/polyline).
Maps to HWPX <hp:curve>.
Fields
points: Vec<ShapePoint>Ordered control points for the curve path.
segment_types: Vec<CurveSegmentType>Segment types (one per segment between points).
style: Option<ShapeStyle>Optional visual style overrides.
ConnectLine
A connect line drawing object (line with control points for routing).
Maps to HWPX <hp:connectLine>.
Fields
start: ShapePointStart point of the connect line.
end: ShapePointEnd point of the connect line.
control_points: Vec<ShapePoint>Intermediate control points for routing.
style: Option<ShapeStyle>Optional visual style overrides.
Bookmark
A bookmark marking a named location in the document.
Maps to HWPX <hp:ctrl><hp:bookmark> (point) or fieldBegin/fieldEnd type="BOOKMARK" (span).
Fields
bookmark_type: BookmarkTypeType: point bookmark or span start/end.
CrossRef
A cross-reference (상호참조) to a bookmark, table, figure, or equation.
Maps to HWPX fieldBegin type="CROSSREF" with parameters.
Fields
content_type: RefContentTypeWhat content to display at the reference site.
Field
A press-field (누름틀) — an interactive form field.
Maps to HWPX fieldBegin type="CLICK_HERE" with parameters and metaTag.
Fields
Memo
A memo (메모) annotation attached to text.
Maps to HWPX fieldBegin type="MEMO" with <hp:subList> body inside.
Fields
Author name.
IndexMark
An index mark for building a document index (찾아보기).
Maps to HWPX <hp:ctrl><hp:indexmark>.
Fields
Unknown
An unrecognized control element preserved for round-trip fidelity.
tag holds the element’s tag name or type identifier.
data holds optional serialized content for lossless preservation.
Implementations§
Source§impl Control
impl Control
Sourcepub fn is_text_box(&self) -> bool
pub fn is_text_box(&self) -> bool
Returns true if this is a Control::TextBox.
Sourcepub fn is_hyperlink(&self) -> bool
pub fn is_hyperlink(&self) -> bool
Returns true if this is a Control::Hyperlink.
Sourcepub fn is_footnote(&self) -> bool
pub fn is_footnote(&self) -> bool
Returns true if this is a Control::Footnote.
Sourcepub fn is_endnote(&self) -> bool
pub fn is_endnote(&self) -> bool
Returns true if this is a Control::Endnote.
Sourcepub fn is_line(&self) -> bool
pub fn is_line(&self) -> bool
Returns true if this is a Control::Line.
Sourcepub fn is_ellipse(&self) -> bool
pub fn is_ellipse(&self) -> bool
Returns true if this is a Control::Ellipse.
Sourcepub fn is_polygon(&self) -> bool
pub fn is_polygon(&self) -> bool
Returns true if this is a Control::Polygon.
Sourcepub fn is_equation(&self) -> bool
pub fn is_equation(&self) -> bool
Returns true if this is a Control::Equation.
Sourcepub fn is_chart(&self) -> bool
pub fn is_chart(&self) -> bool
Returns true if this is a Control::Chart.
Sourcepub fn is_unknown(&self) -> bool
pub fn is_unknown(&self) -> bool
Returns true if this is a Control::Unknown.
Sourcepub fn is_dutmal(&self) -> bool
pub fn is_dutmal(&self) -> bool
Returns true if this is a Control::Dutmal.
Sourcepub fn is_compose(&self) -> bool
pub fn is_compose(&self) -> bool
Returns true if this is a Control::Compose.
Sourcepub fn is_arc(&self) -> bool
pub fn is_arc(&self) -> bool
Returns true if this is a Control::Arc.
Sourcepub fn is_curve(&self) -> bool
pub fn is_curve(&self) -> bool
Returns true if this is a Control::Curve.
Sourcepub fn is_connect_line(&self) -> bool
pub fn is_connect_line(&self) -> bool
Returns true if this is a Control::ConnectLine.
Sourcepub fn is_bookmark(&self) -> bool
pub fn is_bookmark(&self) -> bool
Returns true if this is a Control::Bookmark.
Sourcepub fn is_cross_ref(&self) -> bool
pub fn is_cross_ref(&self) -> bool
Returns true if this is a Control::CrossRef.
Sourcepub fn is_field(&self) -> bool
pub fn is_field(&self) -> bool
Returns true if this is a Control::Field.
Sourcepub fn is_memo(&self) -> bool
pub fn is_memo(&self) -> bool
Returns true if this is a Control::Memo.
Sourcepub fn is_index_mark(&self) -> bool
pub fn is_index_mark(&self) -> bool
Returns true if this is a Control::IndexMark.
Sourcepub fn bookmark(name: &str) -> Self
pub fn bookmark(name: &str) -> Self
Creates a point bookmark at a named location.
§Examples
use hwpforge_core::control::Control;
let bm = Control::bookmark("section1");
assert!(bm.is_bookmark());Sourcepub fn field(hint: &str) -> Self
pub fn field(hint: &str) -> Self
Creates a press-field (누름틀) with the given hint text.
§Examples
use hwpforge_core::control::Control;
let field = Control::field("이름을 입력하세요");
assert!(field.is_field());Sourcepub fn index_mark(primary: &str) -> Self
pub fn index_mark(primary: &str) -> Self
Creates an index mark with a primary key.
§Examples
use hwpforge_core::control::Control;
let mark = Control::index_mark("한글");
assert!(mark.is_index_mark());Sourcepub fn memo(content: Vec<Paragraph>, author: &str, date: &str) -> Self
pub fn memo(content: Vec<Paragraph>, author: &str, date: &str) -> Self
Creates a memo annotation with the given text content.
§Examples
use hwpforge_core::control::Control;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::ParaShapeIndex;
let para = Paragraph::new(ParaShapeIndex::new(0));
let memo = Control::memo(vec![para], "Author", "2026-03-05");
assert!(memo.is_memo());Sourcepub fn cross_ref(
target: &str,
ref_type: RefType,
content_type: RefContentType,
) -> Self
pub fn cross_ref( target: &str, ref_type: RefType, content_type: RefContentType, ) -> Self
Creates a cross-reference to a bookmark target.
§Examples
use hwpforge_core::control::Control;
use hwpforge_foundation::{RefType, RefContentType};
let xref = Control::cross_ref("section1", RefType::Bookmark, RefContentType::Page);
assert!(xref.is_cross_ref());Sourcepub fn chart(chart_type: ChartType, data: ChartData) -> Self
pub fn chart(chart_type: ChartType, data: ChartData) -> Self
Creates a chart control with default dimensions and settings.
Defaults: width ≈ 114mm, height ≈ 66mm, no title, right legend, clustered grouping.
§Examples
use hwpforge_core::control::Control;
use hwpforge_core::chart::{ChartType, ChartData};
let data = ChartData::category(&["A", "B"], &[("S1", &[10.0, 20.0])]);
let ctrl = Control::chart(ChartType::Column, data);
assert!(ctrl.is_chart());Sourcepub fn equation(script: &str) -> Self
pub fn equation(script: &str) -> Self
Creates an equation control with default dimensions for the given HancomEQN script.
Defaults: width ≈ 31mm (8779 HWPUNIT), height ≈ 9.2mm (2600 HWPUNIT),
baseline 71%, black text, HancomEQN font.
§Examples
use hwpforge_core::control::Control;
let ctrl = Control::equation("{a+b} over {c+d}");
assert!(ctrl.is_equation());Sourcepub fn text_box(
paragraphs: Vec<Paragraph>,
width: HwpUnit,
height: HwpUnit,
) -> Self
pub fn text_box( paragraphs: Vec<Paragraph>, width: HwpUnit, height: HwpUnit, ) -> Self
Creates a text box control with the given paragraphs and dimensions.
Defaults: inline positioning (horz_offset=0, vert_offset=0), no caption, no style override.
§Examples
use hwpforge_core::control::Control;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let para = Paragraph::new(ParaShapeIndex::new(0));
let width = HwpUnit::from_mm(80.0).unwrap();
let height = HwpUnit::from_mm(40.0).unwrap();
let ctrl = Control::text_box(vec![para], width, height);
assert!(ctrl.is_text_box());Sourcepub fn footnote(paragraphs: Vec<Paragraph>) -> Self
pub fn footnote(paragraphs: Vec<Paragraph>) -> Self
Creates a footnote control with the given paragraph content.
Defaults: no inst_id.
§Examples
use hwpforge_core::control::Control;
use hwpforge_core::run::Run;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{CharShapeIndex, ParaShapeIndex};
let para = Paragraph::with_runs(
vec![Run::text("Note text", CharShapeIndex::new(0))],
ParaShapeIndex::new(0),
);
let ctrl = Control::footnote(vec![para]);
assert!(ctrl.is_footnote());Sourcepub fn endnote(paragraphs: Vec<Paragraph>) -> Self
pub fn endnote(paragraphs: Vec<Paragraph>) -> Self
Creates an endnote control with the given paragraph content.
Defaults: no inst_id.
§Examples
use hwpforge_core::control::Control;
use hwpforge_core::run::Run;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{CharShapeIndex, ParaShapeIndex};
let para = Paragraph::with_runs(
vec![Run::text("End note", CharShapeIndex::new(0))],
ParaShapeIndex::new(0),
);
let ctrl = Control::endnote(vec![para]);
assert!(ctrl.is_endnote());Sourcepub fn footnote_with_id(inst_id: u32, paragraphs: Vec<Paragraph>) -> Self
pub fn footnote_with_id(inst_id: u32, paragraphs: Vec<Paragraph>) -> Self
Creates a footnote with an explicit instance ID for cross-referencing.
Use this when you need stable inst_id references (e.g. matching decoder output).
For simple footnotes without cross-references, prefer Control::footnote.
§Examples
use hwpforge_core::control::Control;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::ParaShapeIndex;
let ctrl = Control::footnote_with_id(1, vec![Paragraph::new(ParaShapeIndex::new(0))]);
assert!(ctrl.is_footnote());Sourcepub fn endnote_with_id(inst_id: u32, paragraphs: Vec<Paragraph>) -> Self
pub fn endnote_with_id(inst_id: u32, paragraphs: Vec<Paragraph>) -> Self
Creates an endnote with an explicit instance ID for cross-referencing.
Use this when you need stable inst_id references (e.g. matching decoder output).
For simple endnotes without cross-references, prefer Control::endnote.
§Examples
use hwpforge_core::control::Control;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::ParaShapeIndex;
let ctrl = Control::endnote_with_id(2, vec![Paragraph::new(ParaShapeIndex::new(0))]);
assert!(ctrl.is_endnote());Sourcepub fn ellipse(width: HwpUnit, height: HwpUnit) -> Self
pub fn ellipse(width: HwpUnit, height: HwpUnit) -> Self
Creates an ellipse control with the given bounding box dimensions.
Geometry is auto-derived: center=(w/2, h/2), axis1=(w, h/2), axis2=(w/2, h). Defaults: inline positioning (horz_offset=0, vert_offset=0), no paragraphs, no caption, no style.
§Examples
use hwpforge_core::control::Control;
use hwpforge_foundation::HwpUnit;
let width = HwpUnit::from_mm(40.0).unwrap();
let height = HwpUnit::from_mm(30.0).unwrap();
let ctrl = Control::ellipse(width, height);
assert!(ctrl.is_ellipse());Sourcepub fn ellipse_with_text(
width: HwpUnit,
height: HwpUnit,
paragraphs: Vec<Paragraph>,
) -> Self
pub fn ellipse_with_text( width: HwpUnit, height: HwpUnit, paragraphs: Vec<Paragraph>, ) -> Self
Creates an ellipse control with paragraph content inside.
Same as Control::ellipse but accepts paragraphs for text drawn inside the ellipse.
Geometry is auto-derived: center=(w/2, h/2), axis1=(w, h/2), axis2=(w/2, h).
Defaults: inline positioning (horz_offset=0, vert_offset=0), no caption, no style.
§Examples
use hwpforge_core::control::Control;
use hwpforge_core::paragraph::Paragraph;
use hwpforge_foundation::{HwpUnit, ParaShapeIndex};
let width = HwpUnit::from_mm(40.0).unwrap();
let height = HwpUnit::from_mm(30.0).unwrap();
let para = Paragraph::new(ParaShapeIndex::new(0));
let ctrl = Control::ellipse_with_text(width, height, vec![para]);
assert!(ctrl.is_ellipse());Sourcepub fn polygon(vertices: Vec<ShapePoint>) -> CoreResult<Self>
pub fn polygon(vertices: Vec<ShapePoint>) -> CoreResult<Self>
Creates a polygon control from the given vertices.
The bounding box is auto-derived from the min/max of vertex coordinates. Defaults: no paragraphs, no caption, no style.
Returns an error if fewer than 3 vertices are provided.
§Errors
Returns CoreError::InvalidStructure if vertices.len() < 3.
§Examples
use hwpforge_core::control::{Control, ShapePoint};
let vertices = vec![
ShapePoint::new(0, 1000),
ShapePoint::new(500, 0),
ShapePoint::new(1000, 1000),
];
let ctrl = Control::polygon(vertices).unwrap();
assert!(ctrl.is_polygon());Sourcepub fn line(start: ShapePoint, end: ShapePoint) -> CoreResult<Self>
pub fn line(start: ShapePoint, end: ShapePoint) -> CoreResult<Self>
Creates a line control between two endpoints.
The bounding box width and height are derived from the absolute difference
of the endpoint coordinates: width = |end.x - start.x|, height = |end.y - start.y|.
Each axis is clamped to a minimum of 100 HwpUnit (~1pt) because 한글 cannot
render lines with a zero-dimension bounding box.
Defaults: no caption, no style.
Returns an error if start and end are the same point (degenerate line).
§Errors
Returns CoreError::InvalidStructure if start equals end.
§Examples
use hwpforge_core::control::{Control, ShapePoint};
let ctrl = Control::line(ShapePoint::new(0, 0), ShapePoint::new(5000, 0)).unwrap();
assert!(ctrl.is_line());Sourcepub fn horizontal_line(width: HwpUnit) -> Self
pub fn horizontal_line(width: HwpUnit) -> Self
Creates a horizontal line of the given width.
Shortcut for line(ShapePoint::new(0, 0), ShapePoint::new(width.as_i32(), 0)).
The bounding box height is clamped to 100 HwpUnit (~1pt minimum) because
한글 cannot render lines with a zero-dimension bounding box.
Defaults: no caption, no style.
§Examples
use hwpforge_core::control::Control;
use hwpforge_foundation::HwpUnit;
let width = HwpUnit::from_mm(100.0).unwrap();
let ctrl = Control::horizontal_line(width);
assert!(ctrl.is_line());Sourcepub fn dutmal(main_text: impl Into<String>, sub_text: impl Into<String>) -> Self
pub fn dutmal(main_text: impl Into<String>, sub_text: impl Into<String>) -> Self
Creates a dutmal (annotation text) control with default positioning.
Defaults: position = Top, sz_ratio = 0 (auto), align = Center.
§Examples
use hwpforge_core::control::Control;
let ctrl = Control::dutmal("본문", "주석");
assert!(ctrl.is_dutmal());Sourcepub fn compose(text: impl Into<String>) -> Self
pub fn compose(text: impl Into<String>) -> Self
Creates a compose (글자겹침) control with default settings.
Defaults: circle_type = "SHAPE_REVERSAL_TIRANGLE" (spec typo preserved),
char_sz = -3, compose_type = "SPREAD".
§Examples
use hwpforge_core::control::Control;
let ctrl = Control::compose("12");
assert!(ctrl.is_compose());Sourcepub fn arc(arc_type: ArcType, width: HwpUnit, height: HwpUnit) -> Self
pub fn arc(arc_type: ArcType, width: HwpUnit, height: HwpUnit) -> Self
Creates an arc control with the given bounding box dimensions.
Geometry is auto-derived from the bounding box. Defaults: inline positioning, no caption, no style.
§Examples
use hwpforge_core::control::Control;
use hwpforge_foundation::{ArcType, HwpUnit};
let width = HwpUnit::from_mm(40.0).unwrap();
let height = HwpUnit::from_mm(30.0).unwrap();
let ctrl = Control::arc(ArcType::Pie, width, height);
assert!(ctrl.is_arc());Sourcepub fn curve(points: Vec<ShapePoint>) -> CoreResult<Self>
pub fn curve(points: Vec<ShapePoint>) -> CoreResult<Self>
Creates a curve control from the given control points.
All segments default to CurveSegmentType::Curve.
The bounding box is auto-derived from min/max of point coordinates.
Returns an error if fewer than 2 points are provided.
§Errors
Returns CoreError::InvalidStructure if points.len() < 2.
§Examples
use hwpforge_core::control::{Control, ShapePoint};
let pts = vec![
ShapePoint::new(0, 0),
ShapePoint::new(2500, 5000),
ShapePoint::new(5000, 0),
];
let ctrl = Control::curve(pts).unwrap();
assert!(ctrl.is_curve());Sourcepub fn connect_line(start: ShapePoint, end: ShapePoint) -> CoreResult<Self>
pub fn connect_line(start: ShapePoint, end: ShapePoint) -> CoreResult<Self>
Creates a connect line between two endpoints.
Defaults: no control points, type “STRAIGHT”, no caption, no style.
Returns an error if start equals end.
§Errors
Returns CoreError::InvalidStructure if start equals end.
§Examples
use hwpforge_core::control::{Control, ShapePoint};
let ctrl = Control::connect_line(
ShapePoint::new(0, 0),
ShapePoint::new(5000, 5000),
).unwrap();
assert!(ctrl.is_connect_line());Trait Implementations§
Source§impl<'de> Deserialize<'de> for Control
impl<'de> Deserialize<'de> for Control
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl JsonSchema for Control
impl JsonSchema for Control
Source§fn schema_id() -> Cow<'static, str>
fn schema_id() -> Cow<'static, str>
Source§fn json_schema(generator: &mut SchemaGenerator) -> Schema
fn json_schema(generator: &mut SchemaGenerator) -> Schema
Source§fn inline_schema() -> bool
fn inline_schema() -> bool
$ref keyword. Read more