VerticesComp(3U)

πŸ‘‘ VerticesComp(3U) β€” bestie edition πŸ’…

okay so this is from the InterViews Reference Manual, and it's giving "abstract base class trilogy" energy. three icons, one page. let's go ✨


🌸 NAME 🌸

VerticesComp, VerticesView, PSVertices β€” the abstract base classes for vertexed graphical component subjects and their views and their PostScript external representations. three of them. a whole squad 🫢


✨ SYNOPSIS ✨

#include <Unidraw/Components/vertices.h>

that's it. that's the whole synopsis. short and iconic πŸ’–


πŸ¦‹ DESCRIPTION πŸ¦‹

okay so real talk, all three of these are abstract β€” meaning you don't instantiate them directly, you subclass them. they're the blueprint, not the fit. periodt.

VerticesComp is an abstract base class for graphical components whose geometry can be expressed as a list of coordinate pairs. literally just points. a whole vibe made of points. and it uses a Vertices graphic to store its graphical attributes β€” that's where the ✨look✨ lives.

VerticesView is an abstract GraphicView subclass for displaying a VerticesComp. it's the view. it shows the thing. main character energy but for rendering πŸ‘‘

PSVertices is an abstract PostScriptView for subclasses that externalize VerticesComp information in PostScript form. so like… it's the version of your vertices that escapes into the printer world. no cap πŸ–¨οΈ


πŸ’œ VERTICESCOMP PUBLIC OPERATIONS πŸ’œ

  • Vertices* GetVertices() β€” returns the Vertices graphic that defines the vertices's attributes. and ngl, GetVertices is literally just a more specific form of the GetGraphic operation. same energy, more precision πŸŽ€

🌈 VERTICESCOMP PROTECTED OPERATIONS 🌈

  • VerticesComp(Vertices* = nil) β€” the constructor, bestie. it takes an optional vertices graphic that defines the component's graphical attributes. pass nothing? cool, nil is fine. pass a Vertices? now we're cooking πŸ’…

⭐ VERTICESVIEW PUBLIC OPERATIONS ⭐

  • virtual void Interpret(Command*) β€” VerticesView interprets AlignToGridCmd to align its first vertex to the grid. just the first one. the rest follow, iykyk πŸ“
  • virtual void GetVertices(Coord*& x, Coord*& y, int& count) β€” returns the view's vertices in canvas coordinates. heads up though: GetVertices allocates new arrays every single time it's called. every time. so like, don't call it in a loop unless you love memory management 😭
  • VerticesComp* GetVerticesComp() β€” returns the subject. that's the whole job. slay 🫢

πŸ“ VERTICESVIEW PROTECTED OPERATIONS πŸ“

  • VerticesView(VerticesComp* = nil) β€” initializes a VerticesView, optionally supplying the subject. optional subject is optional 🌸
  • virtual void CreateHandles() β€” VerticesView redefines CreateHandles to create a RubberHandles object that draws a handle coinciding with each vertex. so every point gets its own little handle. cute, honestly ✨
  • virtual boolean VertexChanged() β€” returns whether or not the vertices as stored in the view are different in any way from those stored in the subject. the Update function relies on this result to decide whether to recreate the view's structured graphic based on the subject's. here's the tea though: VerticesView::VertexChanged conservatively returns false by default. subclasses should redefine this function to make a more discerning decision β€” which, in turn, increases the efficiency of the update operation. so like, default is safe-but-lazy, and you can do better πŸ”₯

🧚 PSVERTICES PROTECTED OPERATIONS 🧚

  • PSVertices(VerticesComp* = nil) β€” initialize a PostScript external representation of the given subject, if any. "if any" is doing a lot of work there but okay πŸ’–
  • virtual const char* Name() β€” subclasses should redefine Name to return the proper tag for the object in the PostScript output, as required for idraw compatibility. don't skip this one, the tag matters fr fr πŸŽ€

πŸ‘€ SEE ALSO πŸ‘€

GraphicComp(3U), GraphicView(3U), Grid(3U), PatternCmd(3U), PostScriptView(3U), Vertices(3U), align(3U), idraw(3I)

go read those next, bestie, they're all connected πŸ¦‹


Unidraw Β· 23 January 1991 Β· VerticesComp(3U)

and that's the whole page!! mwah πŸ’‹ this one came straight out of the Unidraw era, dated 23 January 1991, and it's still serving. go build something vertexed, you got this πŸ‘‘πŸ’–