pandid: licensing and third-party notices
=========================================

This distribution contains material under two different licences. Which one
applies depends on the file.


1. The engine: PolyForm Small Business License 1.0.0
----------------------------------------------------

Everything in this repository EXCEPT the files listed in section 2 is

    Copyright (c) Alex Anderson
    Licensed under the PolyForm Small Business License 1.0.0
    See LICENSE, or https://polyformproject.org/licenses/small-business/1.0.0

In short: free to use for individuals, for research and teaching, and for any
company with fewer than 100 people and under 1,000,000 USD (2019, inflation
adjusted) of revenue in its prior tax year. A company above either threshold
needs a separate commercial licence. See the Licensing section of README.md.

This is a source-available licence, not an OSI-approved open-source licence.


2. Equipment symbols: Apache License 2.0
----------------------------------------

The drawn equipment symbols are derived from the draw.io / diagrams.net P&ID
stencil library:

    https://github.com/jgraph/drawio  (src/main/webapp/stencils/pid)
    Copyright (c) JGraph Ltd, draw.io / diagrams.net
    Licensed under the Apache License, Version 2.0
    See LICENSE-APACHE, or http://www.apache.org/licenses/LICENSE-2.0

The stencil directory carries a second licence file of its own, at
src/main/webapp/stencils/LICENSE. It does not replace the Apache grant above
and does not revoke it. It adds one field-of-use restriction on the artwork,
reproduced here in full:

    The icon sets and stencil libraries included in this software, and any
    derivatives thereof (including conversions to other formats, traced
    reproductions, substantially similar visual representations, or
    AI-generated images created using these icons as reference or training
    input), may not be used as software assets in, distributed for use with,
    or incorporated into Atlassian products or products distributed through
    the Atlassian marketplace or plugin ecosystem, without explicit written
    permission.

    This restriction does not apply to end-user diagram output (such as
    exported images or documents) created using this software.

The symbol geometry this project generates is a conversion of that artwork to
another format, so the restriction travels with it and with anyone who
redistributes it. A drawing you produce with pandid is diagram output, which
the second paragraph excludes. Nothing else in this distribution is affected.

The following are derivative works of that library and remain under the Apache
License 2.0, NOT the PolyForm licence above:

    pandid/render/_vendored_symbols.py     generated symbol geometry
    scripts/vendor_data/drawio/         the source mxGraph stencil XML

One stencil-derived symbol is written by hand rather than generated, because it
has to be drawn to a size the diagram gives it and the generator emits fixed
geometry. It therefore lives in a file section 1 otherwise covers, and only that
symbol is Apache-2.0:

    pandid/render/symbols.py, conveyor_symbol() and the CONVEYOR_* constants it
    draws from, adapted from the shape "Drier (Roller Conveyor Belt)" in
    scripts/vendor_data/drawio/driers.xml, with the drier housing dropped and
    the distance between the two rollers made a parameter. The rest of
    pandid/render/symbols.py is original and falls under section 1.

The source stencils are converted from mxGraph stencil XML to SVG by
scripts/mxgraph_to_svg.py, driven by the mapping table in
scripts/vendor_symbols.py. Port anchor positions are taken from each stencil's
named <constraint> connections (or re-derived on the bounding-box edge) for
this project's routing model.

The files under scripts/vendor_data/drawio/ are unmodified copies of the
upstream stencils. Where a shape is drawn wrongly upstream, the correction is
applied on the way through instead, from STENCIL_PATCHES in
scripts/vendor_symbols.py, so the generated geometry in
pandid/render/_vendored_symbols.py differs from what draw.io draws. Each patch
names the shape and what is wrong with it. Those fragments are written in the
stencil's own drawing language and quote the shapes they correct, so they are
derivative of the Apache-2.0 library and are covered by this section, not by
section 1; the rest of scripts/vendor_symbols.py is original. At present there
is one: the seat of valves.xml "Globe Valve", which upstream ships as a copy of
its "Ball Valve".

Feed/Product boundary markers, the instrument balloons, the variable-port Mixer
and Splitter symbols, and the pipe tee are original geometric primitives and
fall under section 1. The draw.io library draws no bare junction, and the tee is
two straight line segments.
