libdrawio

package
v0.0.0-...-4fbd628 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 26, 2022 License: MIT Imports: 11 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Diagram

type Diagram struct {
	Id    string `xml:"id,attr"`
	Name  string `xml:"name,attr"`
	Value string `xml:",chardata"`
}

type MxCell

type MxCell struct {
	Id     string      `xml:"id,attr,omitempty"`
	Value  *string     `xml:"value,attr,omitempty"`
	Style  string      `xml:"style,attr,omitempty"`
	Parent string      `xml:"parent,attr,omitempty"`
	Source string      `xml:"source,attr,omitempty"`
	Target string      `xml:"target,attr,omitempty"`
	Edge   string      `xml:"edge,attr,omitempty"`
	Vertex string      `xml:"vertex,attr,omitempty"`
	Geo    *MxGeometry `xml:"mxGeometry"`
}

type MxFile

type MxFile struct {
	XMLName  xml.Name  `xml:"mxfile"`
	Host     string    `xml:"host,attr"`
	Modified string    `xml:"modified,attr"`
	Agent    string    `xml:"agent,attr"`
	Version  string    `xml:"version,attr"`
	Type     string    `xml:"type,attr"`
	Etag     string    `xml:"etag,attr"`
	Diagram  []Diagram `xml:"diagram"`
}

func NewMxFile

func NewMxFile(filepath string) (*MxFile, error)

Load drawio file, then map to MxFile struct.

func (*MxFile) Write

func (m *MxFile) Write(filepath string) error

Write MxFile.

type MxGeometry

type MxGeometry struct {
	X        string   `xml:"x,attr"`
	Y        string   `xml:"y,attr"`
	Width    string   `xml:"width,attr"`
	Height   string   `xml:"height,attr"`
	As       string   `xml:"as,attr"`
	Relative string   `xml:"relative,attr,omitempty"`
	MxPoint  *MxPoint `xml:"mxPoint"`
}

type MxGraphModel

type MxGraphModel struct {
	XMLName    xml.Name `xml:"mxGraphModel"`
	Content    Root     `xml:"root"`
	Dx         string   `xml:"dx,attr"`
	Dy         string   `xml:"dy,attr"`
	Grid       string   `xml:"grid,attr"`
	GridSize   string   `xml:"gridSize,attr"`
	Guides     string   `xml:"guides,attr"`
	Tooltips   string   `xml:"tooltips,attr"`
	Connect    string   `xml:"connect,attr"`
	Arrows     string   `xml:"arrows,attr"`
	Fold       string   `xml:"fold,attr"`
	Page       string   `xml:"page,attr"`
	PageScale  string   `xml:"pageScale,attr"`
	PageWidth  string   `xml:"pageWidth,attr"`
	PageHeight string   `xml:"pageHeight,attr"`
	Math       string   `xml:"math,attr"`
	Shadow     string   `xml:"shadow,attr"`
	Title      *string
}

func Decompress

func Decompress(compressedStr string) (*MxGraphModel, error)

Decompress compressed MxGraphModel string. Map to MxGraphModel struct after decompress string.

func (*MxGraphModel) Compress

func (m *MxGraphModel) Compress() (string, error)

Compress MxGraphModel string.

func (*MxGraphModel) FindMxCell

func (m *MxGraphModel) FindMxCell(id string) *MxCell

Find MxCell from MxGraphModel.Mxcells by ID.

func (*MxGraphModel) FindObject

func (m *MxGraphModel) FindObject(id string) *Object

Find Object from MxGraphModel.Object by ID.

func (*MxGraphModel) GetIds

func (m *MxGraphModel) GetIds() []string

Get Object and MxCell ID list.

type MxLibObject

type MxLibObject struct {
	Xml   string `json:"xml"`
	W     int    `json:"w"`
	H     int    `json:"h"`
	Title string `json:"title"`
}

type MxLibrary

type MxLibrary struct {
	XMLName       xml.Name `xml:"mxlibrary"`
	Value         string   `xml:",chardata"`
	MxGraphModels []MxGraphModel
}

func NewMxLibrary

func NewMxLibrary() *MxLibrary

func (*MxLibrary) MakeMxLibObj

func (m *MxLibrary) MakeMxLibObj(mxGraphModel *MxGraphModel, title string, height, width int) (*MxLibObject, error)

Make MxLibObj from MxGraphModel, title, height, width

func (*MxLibrary) MakeMxLibrary

func (m *MxLibrary) MakeMxLibrary(mxlibObjects []MxLibObject) error

Make MxLibrary string from MxLibrary.MxGraphModels, then set to MxLibrary.Value.

func (*MxLibrary) Write

func (m *MxLibrary) Write(filepath string) error

Write MxLibrary to xml file.

type MxPoint

type MxPoint struct {
	X  string `xml:"x,attr"`
	Y  string `xml:"y,attr"`
	As string `xml:"as,attr"`
}

type Object

type Object struct {
	Id        string     `xml:"id,attr,omitempty"`
	Label     string     `xml:"label,attr"`
	MxCell    MxCell     `xml:"mxCell"`
	DataLabel []xml.Attr `xml:",any,attr"`
}

type Root

type Root struct {
	Object  []Object `xml:"object"`
	MxCells []MxCell `xml:"mxCell"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL