[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: images that play nicely with revision control?



On 11/02/14 01:04, Hendrik Boom wrote:
On Sun, 09 Feb 2014 10:47:11 -0600, Richard Owlett wrote:

Hendrik Boom wrote:
I'm looking for a file format for images that plays nicely with
revision control. Ideally I'd like to edit them while seeing what I'm
editing, whether it's a line drawing (like inkscape) or a pixel map.
[snip]
You didn't say much about your actual drawing mixture.
I'd probably be willing to adapt my drawing style to the technology that
works with my revision control.  The drawings I'm interested in are
development tools for for novels or computer programs.  One might be
block diagrams of the main components of a program and their
relationships.  Another might be a picture of the main character of a
story, or a map of the country, or the layout of a character's house.
These are working drawings than high art.  And they're not static.  Oh, I
don't mean they're animations... I mean that as the months go by, they
need to be changed, as my understanding of the things they represent
changes.
I that case I would recommend you look at latex and specifically \tikzpicture. The NODE feature of \tikz allows you to get shapes from a shape library and then link them with arrows.

I have been using latex for a while as my documentation engine of choice, with the raw text markup going into the repository.

Take a look at this manual - it is organised so there is an introductory tutorial first, with more detailed references later.

http://mirrors.ctan.org/graphics/pgf/base/doc/generic/pgf/pgfmanual.pdf

I currently use sublime text 2 as my editor, and with the latex plugin a ctrl-B builds the document as a pdf almost instantenously.

I have also developed a "house style" hartley.cls (My one man consultancy is called Hartley Consultants) for my documents which I installed in ~/texmf/tex/latex/hartley.cls. Now at the top of each document all I have to do is say

\documentclass{hartley}

and I get a standard format (article like) document

just to give a flavour of the picture drawing capability (unusable unless you include "\usetikzlibrary{fit,positioning,decorations.pathmorphing}" at the top of the whole document) - here is a picture of 3 computers (one outside the home, 2 inside) with a load of applications drawn inside each There is a router, called "superhub" which links inside to out, and there is a wiggly line (see snake) separating inside and out.

The line
%    \draw[help lines] (0,-7) grid(12,7);
is commented out (% represents rest of line is a comment) but I used as I was building up the drawing to provide a grid behind the picture so I could see where I was placing things.

\begin{figure}
\begin{tikzpicture} [font=\footnotesize,inner sep=0.1cm,rectangle,remember picture,node distance=0.1cm,
    machine/.style={fill=blue!30,inner sep=0.2cm},
    machinename/.style={font=\sffamily},
    servicename/.style={font=\itshape,text width=1.5cm},
application/.style={draw,text width=2cm,text badly centered,rounded corners,fill=white},
    panel/.style={rectangle,text width=2.5cm},
service/.style={rectangle,draw,thin,text badly centered,text width=1cm,fill=white},
    point/.style=coordinate,
applicationstack/.style={draw,thick,text width=2.5cm,rounded corners,fill=white}]
%    \draw[help lines] (0,-7) grid(12,7);
    % avalon
    \node[machinename] (avalon) at(3,7) {Avalon};
    \node (avalonapps) [below=of avalon] {\tikz {
        \node[application,text width=2.5cm] (web) {\tikz {
            \node[servicename] (http) {http};
            \node[application] (hc) [below=of http]{Hartley Consultants};
            \node[application] (cf) [below=of hc] {Chandler Family};
            \node[application] (multiple) [below=of cf] {Multiple Clients};
        }};
\node[application] (httpsservices) [below right=0.2cm of web.north east] {\tikz {
                \node[servicename](https) {https};
\node[application,text width=1.5cm](planner) [below= of https]{Planner};
        }};
        \node[application](chat)[below=of httpsservices] {Chat Server};
        \node[application](mx) [below=of chat] {Mail Forwarding};
    }};
    % boundary and superhub
    \node[point](leftside) at(0,0){};
    \node[point](rightside) at (12,0){};
\node [application,text width= 2.7cm,fill=red!20] (superhub) at (4,0) {\tikz {
        \node[servicename] (superh) {Super Hub};
        \node[application] (firewall) [below=of superh] {Firewall};
        \node (hubservices) [below=of firewall] {\tikz {
            \node[service] (nat) {NAT};
            \node[service] (dhcp) [below=of nat] {\sout{DHCP}};
\node[service] (fwd) [below right=of nat.north east] {Port Fwd};
        }};
    }};

    \draw[decorate,decoration={snake,post length=2mm}]
        (leftside) -- (superhub);
    \draw[decorate,decoration={snake,post length=2mm}]
        (rightside) -- (superhub);
    \node[machinename,above left=of rightside]{External Internet};
    \node[machinename,below left=of rightside] {In the house};
    %Piserver
    \node[machinename] (piserver) at(8,-2.5) {Piserver};
    \node [matrix,column sep=2mm] (piapps) [below=of piserver] {
        \node[panel] (secureweb) {\tikz{
            \node [applicationstack] (cfhttpsstack) {\tikz{
                \node[servicename] (cfhttps) {https};
\node[application] (backupproxy) [below=of cfhttps]{Backup Proxy}; \node[application] (passwd) [below=of backupproxy]{Password Management}; \node[application] (cfchat) [below=of passwd] {Chat Server};
                \node[application] (webmail)[below=of cfchat] {Web Mail};
\node[application] (akcmoney) [below=of webmail]{AKC Money};
            }};
\node[applicationstack] (cfhttpstack) [below= of cfhttpsstack] {\tikz{
                \node[servicename] (cfhttp) {http};
\node[application] (chandlerproxy) [below=of cfhttp] {Chandler Family Proxy};
            }};
        }}; &
        \node[panel] (networkservices) {\tikz{
            \node[applicationstack] (ntpstack)  {\tikz{
                \node[servicename] (ntp) {ntp};
\node[application] (ntpservice) [below=of ntp] {Time Services};
            }};
\node[applicationstack] (dhcpstack) [below= of ntpstack] {\tikz{
                \node[servicename] (cfdhcp) {dhcp};
\node[application] (cfchcpservices) [below=of cfdhcp] {DHCP Services};
            }};
            \node[applicationstack] (dnsstack) [below=of dhcpstack] {\tikz{
                \node[servicename] (dns) {DNS};
\node[application] (home) [below=of dns] {.home Domain server};
            }};
            \node[applicationstack] (sshstack) [below=of dnsstack] {\tikz{
                \node[servicename] (ssh) {SSH};
\node[application] (sshgateway) [below=of ssh] {SSH Gateway};
            }};
        }}; &
        \node[panel] (mail) {\tikz{
            \node[applicationstack] (imapstack) {\tikz{
                \node[servicename] (imap) {imap};
\node[application] (imapauth) [below=of imap]{Mail Authentication}; \node[application] (imapstore) [below=of imapauth] {Mail Storage};
            }};
\node[applicationstack] (smtpstack) [below=of imapstack] {\tikz{
                \node[servicename] (smtp) {smtp};
                \node[application] (mta) [below=of smtp] {Mail Routing};
            }};
\node[applicationstack] (ldapstack) [below=of smtpstack] {\tikz{
                \node[servicename] (ldap){ldap};
\node[application] (userdb) [below=of ldap] {User database}; \node[application] (addressbook) [below=of userdb] {Family Addressbook};
            }};
        }}; \\
    };
    %Owl
    \node[machinename] (owl) [left=20mm of piapps.north west] {Owl};
    \node[application] (mythtv) [below=of owl] {Myth TV};
    \node[application] (backup) [below=of mythtv] {Backup};
%I do the backgrounds of the machines last as they just fit around the internal nodes
    \begin{pgfonlayer}{background}
        \node[machine,fit=(avalon) (avalonapps)]{};
        \node[machine,fit=(piserver) (piapps)] {};
        \node[machine,fit=(owl) (mythtv) (backup)] {};
    \end{pgfonlayer}

\end{tikzpicture}
\caption{Overall Architecture\label{fig:architecure}}
\end{figure}







Reply to: