1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669
|
.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2018 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.ogl.lines
.. highlight:: python
.. _wx.lib.ogl.lines.LineShape:
==========================================================================================================================================
|phoenix_title| **wx.lib.ogl.lines.LineShape**
==========================================================================================================================================
The LineShape class may be attached to two nodes, it may be segmented,
in which case a control point is drawn for each joint.
A :class:`LineShape` may have arrows at the beginning, end and centre.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html
<div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
<img id="toggleBlock-trigger" src="_static/images/closed.png"/>
Inheritance diagram for class <strong>LineShape</strong>:
</div>
<div id="toggleBlock-summary" style="display:block;"></div>
<div id="toggleBlock-content" style="display:none;">
<p class="graphviz">
<center><img src="_static/images/inheritance/wx.lib.ogl.lines.LineShape_inheritance.png" alt="Inheritance diagram of LineShape" usemap="#dummy" class="inheritance"/></center>
</div>
<script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
<map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.lib.ogl.basic.Shape.html" title="wx.lib.ogl.basic.Shape" alt="" coords="39,83,200,112"/> <area shape="rect" id="node3" href="wx.lib.ogl.lines.LineShape.html" title="wx.lib.ogl.lines.LineShape" alt="" coords="29,160,211,189"/> <area shape="rect" id="node2" href="wx.lib.ogl.basic.ShapeEvtHandler.html" title="wx.lib.ogl.basic.ShapeEvtHandler" alt="" coords="5,5,235,35"/> </map>
</p>
|
|super_classes| Known Superclasses
==================================
:class:`wx.lib.ogl.basic.Shape`
|
|method_summary| Methods Summary
================================
================================================================================ ================================================================================
:meth:`~wx.lib.ogl.lines.LineShape.__init__` Default class constructor.
:meth:`~wx.lib.ogl.lines.LineShape.AddArrow` Add an arrow (or annotation) to the line.
:meth:`~wx.lib.ogl.lines.LineShape.AddArrowOrdered` Add an arrowhead in the position indicated by the reference list
:meth:`~wx.lib.ogl.lines.LineShape.ClearArrow` Delete the arrow with the given name.
:meth:`~wx.lib.ogl.lines.LineShape.ClearArrowsAtPosition` Delete the arrows at the specified position, or at any position if position is -1.
:meth:`~wx.lib.ogl.lines.LineShape.Delete` Delete the line, unlink it first.
:meth:`~wx.lib.ogl.lines.LineShape.DeleteArrowHead` Delete arrowhead by position and name.
:meth:`~wx.lib.ogl.lines.LineShape.DeleteArrowHeadId` Delete arrowhead by id.
:meth:`~wx.lib.ogl.lines.LineShape.DeleteLineControlPoint` Delete an arbitary point on the line.
:meth:`~wx.lib.ogl.lines.LineShape.Draggable` Line is not draggable.
:meth:`~wx.lib.ogl.lines.LineShape.DrawArrow` Draw the given arrowhead (or annotation).
:meth:`~wx.lib.ogl.lines.LineShape.DrawArrows` Draw all arrows.
:meth:`~wx.lib.ogl.lines.LineShape.DrawRegion` Format one region at this position.
:meth:`~wx.lib.ogl.lines.LineShape.EraseRegion` Erase one region at this position.
:meth:`~wx.lib.ogl.lines.LineShape.FindArrowHead` Find arrowhead by position and name.
:meth:`~wx.lib.ogl.lines.LineShape.FindArrowHeadId` Find arrowhead by id.
:meth:`~wx.lib.ogl.lines.LineShape.FindLineEndPoints` Finds the x, y points at the two ends of the line.
:meth:`~wx.lib.ogl.lines.LineShape.FindLinePosition` Find which position we're talking about.
:meth:`~wx.lib.ogl.lines.LineShape.FindMinimumWidth` Find the horizontal width for drawing a line with arrows in
:meth:`~wx.lib.ogl.lines.LineShape.FindNth` Find the position of the line on the given object.
:meth:`~wx.lib.ogl.lines.LineShape.FormatText` Format a text string according to the region size, adding
:meth:`~wx.lib.ogl.lines.LineShape.GetAlignmentEnd` Get alignment end.
:meth:`~wx.lib.ogl.lines.LineShape.GetAlignmentOrientation` Get the alignment orientation.
:meth:`~wx.lib.ogl.lines.LineShape.GetAlignmentStart` Get alignment start
:meth:`~wx.lib.ogl.lines.LineShape.GetAlignmentType` Get the alignment type.
:meth:`~wx.lib.ogl.lines.LineShape.GetArrows` Get the defined arrows.
:meth:`~wx.lib.ogl.lines.LineShape.GetAttachmentFrom` Get the attachment point on the 'from' node.
:meth:`~wx.lib.ogl.lines.LineShape.GetAttachmentTo` Get the attachment point on the 'to' node.
:meth:`~wx.lib.ogl.lines.LineShape.GetBoundingBoxMin` Get the minimum bounding box.
:meth:`~wx.lib.ogl.lines.LineShape.GetEnds` Get the visible endpoints of the lines for drawing between two objects.
:meth:`~wx.lib.ogl.lines.LineShape.GetFrom` Get the 'from' object.
:meth:`~wx.lib.ogl.lines.LineShape.GetLabelPosition` Get the reference point for a label.
:meth:`~wx.lib.ogl.lines.LineShape.GetLineControlPoints` Get the line control points.
:meth:`~wx.lib.ogl.lines.LineShape.GetNextControlPoint` Find the next control point in the line after the start / end point,
:meth:`~wx.lib.ogl.lines.LineShape.GetTo` Get the 'to' object.
:meth:`~wx.lib.ogl.lines.LineShape.HitTest` Line hit test.
:meth:`~wx.lib.ogl.lines.LineShape.Initialise` Initialise the line object.
:meth:`~wx.lib.ogl.lines.LineShape.InsertLineControlPoint` Insert a control point at an optional given position.
:meth:`~wx.lib.ogl.lines.LineShape.IsEnd` `True` if shape is at the end of the line.
:meth:`~wx.lib.ogl.lines.LineShape.IsSpline` If `True` a spline is drawn through the control points.
:meth:`~wx.lib.ogl.lines.LineShape.MakeControlPoints` Make handle control points.
:meth:`~wx.lib.ogl.lines.LineShape.MakeLineControlPoints` Make a given number of control points.
:meth:`~wx.lib.ogl.lines.LineShape.OnBeginDragLeft` not implemented???
:meth:`~wx.lib.ogl.lines.LineShape.OnCreateLabelShape` Create label shape handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnDragLeft` not implemented???
:meth:`~wx.lib.ogl.lines.LineShape.OnDraw` The draw handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnDrawContents` The draw contents handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnDrawControlPoints` The draw control points handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnDrawOutline` The draw outline handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnEndDragLeft` not implemented???
:meth:`~wx.lib.ogl.lines.LineShape.OnErase` The erase handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnEraseControlPoints` The erase control points handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnLabelMovePre` Label move 'pre' handler. ???
:meth:`~wx.lib.ogl.lines.LineShape.OnMoveLink` The move linke handler, called when a connected object has moved, to move the link to
:meth:`~wx.lib.ogl.lines.LineShape.OnMoveMiddleControlPoint` The move middle control point handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnMovePre` The move 'pre' handler. ???
:meth:`~wx.lib.ogl.lines.LineShape.OnSizingBeginDragLeft` The sizing begin drag left handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnSizingDragLeft` The sizing drag left handler.
:meth:`~wx.lib.ogl.lines.LineShape.OnSizingEndDragLeft` The sizing end drag left handler.
:meth:`~wx.lib.ogl.lines.LineShape.ResetControlPoints` Reset the control points.
:meth:`~wx.lib.ogl.lines.LineShape.Select` Overridden select, to create / delete temporary label-moving objects.
:meth:`~wx.lib.ogl.lines.LineShape.SetAlignmentOrientation` Set the alignment orientation.
:meth:`~wx.lib.ogl.lines.LineShape.SetAlignmentType` Set the alignment type.
:meth:`~wx.lib.ogl.lines.LineShape.SetAttachmentFrom` Set the 'from' shape attachment.
:meth:`~wx.lib.ogl.lines.LineShape.SetAttachments` Specify which object attachment points should be used at each end of the line.
:meth:`~wx.lib.ogl.lines.LineShape.SetAttachmentTo` Set the 'to' shape attachment.
:meth:`~wx.lib.ogl.lines.LineShape.SetEnds` Set the end positions of the line.
:meth:`~wx.lib.ogl.lines.LineShape.SetFrom` Set the 'from' object for the line.
:meth:`~wx.lib.ogl.lines.LineShape.SetIgnoreOffsets` Set whether to ignore offsets from the end of the line when drawing.
:meth:`~wx.lib.ogl.lines.LineShape.SetSpline` Specifies whether a spline is to be drawn through the control points.
:meth:`~wx.lib.ogl.lines.LineShape.SetTo` Set the 'to' object for the line.
:meth:`~wx.lib.ogl.lines.LineShape.Straighten` Straighten verticals and horizontals.
:meth:`~wx.lib.ogl.lines.LineShape.Unlink` Unlink the line from the nodes at either end.
================================================================================ ================================================================================
|
|api| Class API
===============
.. class:: LineShape(Shape)
The LineShape class may be attached to two nodes, it may be segmented,
in which case a control point is drawn for each joint.
A :class:`LineShape` may have arrows at the beginning, end and centre.
.. method:: __init__(self)
Default class constructor.
.. method:: AddArrow(self, type, end = ARROW_POSITION_END, size = 10.0, xOffset = 0.0, name = "", mf = None, arrowId = -1)
Add an arrow (or annotation) to the line.
:param `type`: an arrow head type, one of the following
======================================== ==================================
Arrow head type Description
======================================== ==================================
`ARROW_HOLLOW_CIRCLE` a hollow circle
`ARROW_FILLED_CIRCLE` a filled circle
`ARROW_ARROW` an arrow
`ARROW_SINGLE_OBLIQUE` a single oblique
`ARROW_DOUBLE_OBLIQUE` a double oblique
`ARROW_METAFILE` custom, define in metafile
======================================== ==================================
:param `end`: may be one of the following
======================================== ==================================
Arrow head type Description
======================================== ==================================
`ARROW_POSITION_END` arrow appears at the end
`ARROW_POSITION_START` arrow appears at the start
======================================== ==================================
:param `size`: specifies the lenght of the arrow
:param `xOffset`: specifies the offset from the end of the line
:param `name`: specifies a name
:param `mf`: mf can be a wxPseduoMetaFile, perhaps loaded from a simple Windows
metafile.
:param `arrowId`: the id for the arrow
.. method:: AddArrowOrdered(self, arrow, referenceList, end)
Add an arrowhead in the position indicated by the reference list
of arrowheads, which contains all legal arrowheads for this line, in
the correct order. E.g.
Reference list: a b c d e
Current line list: a d
Add c, then line list is: a c d.
If no legal arrowhead position, return FALSE. Assume reference list
is for one end only, since it potentially defines the ordering for
any one of the 3 positions. So we don't check the reference list for
arrowhead position.
:param `arrow`: an instance of :class:`ArrowHead`
:param `referenceList`: ???
:param `end`: ???
.. method:: ClearArrow(self, name)
Delete the arrow with the given name.
:param `name`: name of arrow to delete
.. method:: ClearArrowsAtPosition(self, end)
Delete the arrows at the specified position, or at any position if position is -1.
:param `end`: position to clear arrow from
.. method:: Delete(self)
Delete the line, unlink it first.
.. method:: DeleteArrowHead(self, position, name)
Delete arrowhead by position and name.
if position is -1, matches any position.
:param `position`: position of arrow to delete or -1
:param `name`: name of arrow to delete
.. method:: DeleteArrowHeadId(self, arrowId)
Delete arrowhead by id.
:param `arrowId`: id of arrow to delete
.. method:: DeleteLineControlPoint(self)
Delete an arbitary point on the line.
.. method:: Draggable(self)
Line is not draggable.
:note: This is really to distinguish between lines and other images.
For lines we want to pass drag to canvas, since lines tend to prevent
dragging on a canvas (they get in the way.)
.. method:: DrawArrow(self, dc, arrow, XOffset, proportionalOffset)
Draw the given arrowhead (or annotation).
:param `dc`: an instance of :class:`wx.MemoryDC`
:param `arrow`: an instannce of :class:`ArrowHead`
:param `XOffset`: the x offset ???
:param `proportionalOffset`: ???
.. method:: DrawArrows(self, dc)
Draw all arrows.
.. method:: DrawRegion(self, dc, region, x, y)
Format one region at this position.
:param `dc`: an instance of :class:`wx.MemoryDC`
:param `dc`: an instance of :class:`~lib.ogl.ShapeRegion`
:param `x`: the x position
:param `y`: the y position
.. method:: EraseRegion(self, dc, region, x, y)
Erase one region at this position.
:param `dc`: an instance of :class:`wx.MemoryDC`
:param `dc`: an instance of :class:`~lib.ogl.ShapeRegion`
:param `x`: the x position
:param `y`: the y position
.. method:: FindArrowHead(self, position, name)
Find arrowhead by position and name.
if position is -1, matches any position.
:param `position`: position of arrow to find or -1
:param `name`: name of arrow to find
.. method:: FindArrowHeadId(self, arrowId)
Find arrowhead by id.
:param `arrowId`: id of arrow to find
.. method:: FindLineEndPoints(self)
Finds the x, y points at the two ends of the line.
This function can be used by e.g. line-routing routines to
get the actual points on the two node images where the lines will be
drawn to / from.
.. method:: FindLinePosition(self, x, y)
Find which position we're talking about.
:param `x`: x position
:param `y`: y position
:returns: ARROW_POSITION_START or ARROW_POSITION_MIDDLE or ARROW_POSITION_END.
.. method:: FindMinimumWidth(self)
Find the horizontal width for drawing a line with arrows in
minimum space. Assume arrows at end only.
.. method:: FindNth(self, image, incoming)
Find the position of the line on the given object.
Specify whether incoming or outgoing lines are being considered
with incoming.
:param `image`: a node image
:param `incoming`: ``True`` to get incoming lines ???
:returns: nth line, number of lines ???
.. method:: FormatText(self, dc, s, i)
Format a text string according to the region size, adding
strings with positions to region text list.
:param `dc`: an instance of :class:`wx.MemoryDC`
:param str `s`: the text string
:param int `i`: index to the region to be used???
.. method:: GetAlignmentEnd(self)
Get alignment end.
.. method:: GetAlignmentOrientation(self, isEnd)
Get the alignment orientation.
:param `isEnd`: if ``True`` get the type for the begin, else for the end ???
.. method:: GetAlignmentStart(self)
Get alignment start
.. method:: GetAlignmentType(self, isEnd)
Get the alignment type.
:param `isEnd`: if ``True`` get the type for the begin, else for the end ???
.. method:: GetArrows(self)
Get the defined arrows.
.. method:: GetAttachmentFrom(self)
Get the attachment point on the 'from' node.
.. method:: GetAttachmentTo(self)
Get the attachment point on the 'to' node.
.. method:: GetBoundingBoxMin(self)
Get the minimum bounding box.
.. method:: GetEnds(self)
Get the visible endpoints of the lines for drawing between two objects.
.. method:: GetFrom(self)
Get the 'from' object.
.. method:: GetLabelPosition(self, position)
Get the reference point for a label.
:param `position`: 0 = middle, 1 = start, 2 = end, Region x and y are offsets from this.
.. method:: GetLineControlPoints(self)
Get the line control points.
.. method:: GetNextControlPoint(self, shape)
Find the next control point in the line after the start / end point,
depending on whether the shape is at the start or end.
:param `shape`: an instance of :class:`~lib.ogl.Shape` ???
.. method:: GetTo(self)
Get the 'to' object.
.. method:: HitTest(self, x, y)
Line hit test.
:param `x`: x position
:param `y`: y position
.. method:: Initialise(self)
Initialise the line object.
.. method:: InsertLineControlPoint(self, dc = None, point = None)
Insert a control point at an optional given position.
:param `dc`: an instance of :class:`wx.MemoryDC`
:param `point`: an optional point, otherwise will use _lineControlPoints
.. method:: IsEnd(self, nodeObject)
`True` if shape is at the end of the line.
.. method:: IsSpline(self)
If `True` a spline is drawn through the control points.
.. method:: MakeControlPoints(self)
Make handle control points.
.. method:: MakeLineControlPoints(self, n)
Make a given number of control points.
:param int `n`: number of control points, minimum of two
.. method:: OnBeginDragLeft(self, x, y, keys = 0, attachment = 0)
not implemented???
.. method:: OnCreateLabelShape(self, parent, region, w, h)
Create label shape handler.
.. method:: OnDragLeft(self, draw, x, y, keys = 0, attachment = 0)
not implemented???
.. method:: OnDraw(self, dc)
The draw handler.
.. method:: OnDrawContents(self, dc)
The draw contents handler.
.. method:: OnDrawControlPoints(self, dc)
The draw control points handler.
.. method:: OnDrawOutline(self, dc, x, y, w, h)
The draw outline handler.
.. method:: OnEndDragLeft(self, x, y, keys = 0, attachment = 0)
not implemented???
.. method:: OnErase(self, dc)
The erase handler.
.. method:: OnEraseControlPoints(self, dc)
The erase control points handler.
.. method:: OnLabelMovePre(self, dc, labelShape, x, y, old_x, old_y, display)
Label move 'pre' handler. ???
.. method:: OnMoveLink(self, dc, moveControlPoints = True)
The move linke handler, called when a connected object has moved, to move the link to
correct position.
.. method:: OnMoveMiddleControlPoint(self, dc, lpt, pt)
The move middle control point handler.
.. method:: OnMovePre(self, dc, x, y, old_x, old_y, display = True)
The move 'pre' handler. ???
.. method:: OnSizingBeginDragLeft(self, pt, x, y, keys = 0, attachment = 0)
The sizing begin drag left handler.
.. method:: OnSizingDragLeft(self, pt, draw, x, y, keys = 0, attachment = 0)
The sizing drag left handler.
.. method:: OnSizingEndDragLeft(self, pt, x, y, keys = 0, attachment = 0)
The sizing end drag left handler.
.. method:: ResetControlPoints(self)
Reset the control points.
.. method:: Select(self, select, dc = None)
Overridden select, to create / delete temporary label-moving objects.
.. method:: SetAlignmentOrientation(self, isEnd, isHoriz)
Set the alignment orientation.
:param `isEnd`: ``True`` or ``False`` ???
:param `isHoriz`: ``True`` of ``False`` ???
.. method:: SetAlignmentType(self, isEnd, alignType)
Set the alignment type.
:param `isEnd`: if ``True`` set the type for the begin, else for the end ???
:param `alignType`: one of the following
======================================== ==================================
Arrow head type Description
======================================== ==================================
`LINE_ALIGNMENT_HORIZ` Align horizontally
`LINE_ALIGNMENT_VERT` Align vertically
`LINE_ALIGNMENT_TO_NEXT_HANDLE` Align to next handle
`LINE_ALIGNMENT_NONE` vertical by default
======================================== ==================================
.. method:: SetAttachmentFrom(self, attach)
Set the 'from' shape attachment.
.. method:: SetAttachments(self, from_attach, to_attach)
Specify which object attachment points should be used at each end of the line.
:param `from_attach`: the from points ???
:param `to_attach`: the to points ???
.. method:: SetAttachmentTo(self, attach)
Set the 'to' shape attachment.
.. method:: SetEnds(self, x1, y1, x2, y2)
Set the end positions of the line.
:param: `x1`: x1 position
:param: `y1`: y1 position
:param: `x2`: x2 position
:param: `y2`: y2 position
.. method:: SetFrom(self, object)
Set the 'from' object for the line.
.. method:: SetIgnoreOffsets(self, ignore)
Set whether to ignore offsets from the end of the line when drawing.
.. method:: SetSpline(self, spline)
Specifies whether a spline is to be drawn through the control points.
:param boolean `spline`: ``True`` draw a spline through control points.
.. method:: SetTo(self, object)
Set the 'to' object for the line.
.. method:: Straighten(self, dc = None)
Straighten verticals and horizontals.
:param `dc`: an instance of :class:`wx.MemoryDC` or None
.. method:: Unlink(self)
Unlink the line from the nodes at either end.
|