All Downloads are FREE. Search and download functionalities are using the official Maven repository.

gen.lib.common.emit__c Maven / Gradle / Ivy

There is a newer version: 1.2024.8
Show newest version
// THIS FILE HAS BEEN GENERATED BY A PREPROCESSOR.
/* +=======================================================================
 * |
 * |      PlantUML : a free UML diagram generator
 * |
 * +=======================================================================
 *
 * (C) Copyright 2009-2024, Arnaud Roques
 *
 * Project Info:  https://plantuml.com
 *
 * If you like this project or if you find it useful, you can support us at:
 *
 * https://plantuml.com/patreon (only 1$ per month!)
 * https://plantuml.com/liberapay (only 1€ per month!)
 * https://plantuml.com/paypal
 *
 *
 * PlantUML is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * PlantUML distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
 * License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library.  If not, see .
 *
 * PlantUML can occasionally display sponsored or advertising messages. Those
 * messages are usually generated on welcome or error images and never on
 * functional diagrams.
 * See https://plantuml.com/professional if you want to remove them
 *
 * Images (whatever their format : PNG, SVG, EPS...) generated by running PlantUML
 * are owned by the author of their corresponding sources code (that is, their
 * textual description in PlantUML language). Those images are not covered by
 * this LGPL license.
 *
 * The generated images can then be used without any reference to the LGPL license.
 * It is not even necessary to stipulate that they have been generated with PlantUML,
 * although this will be appreciated by the PlantUML team.
 *
 * There is an exception : if the textual description in PlantUML language is also covered
 * by any license, then the generated images are logically covered
 * by the very same license.
 *
 * This is the IGY distribution (Install GraphViz by Yourself).
 * You have to install GraphViz and to setup the GRAPHVIZ_DOT environment variable
 * (see https://plantuml.com/graphviz-dot )
 *
 * Icons provided by OpenIconic :  https://useiconic.com/open
 * Archimate sprites provided by Archi :  http://www.archimatetool.com
 * Stdlib AWS provided by https://github.com/milo-minderbinder/AWS-PlantUML
 * Stdlib Icons provided https://github.com/tupadr3/plantuml-icon-font-sprites
 * ASCIIMathML (c) Peter Jipsen http://www.chapman.edu/~jipsen
 * ASCIIMathML (c) David Lippman http://www.pierce.ctc.edu/dlippman
 * CafeUndZopfli ported by Eugene Klyuchnikov https://github.com/eustas/CafeUndZopfli
 * Brotli (c) by the Brotli Authors https://github.com/google/brotli
 * Themes (c) by Brett Schwarz https://github.com/bschwarz/puml-themes
 * Twemoji (c) by Twitter at https://twemoji.twitter.com/
 *
 */
package gen.lib.common;
import static gen.lib.cgraph.attr__c.agget;
import static gen.lib.common.geom__c.ptToLine2;
import static gen.lib.common.utils__c.Bezier;
import static smetana.core.Macro.UNSUPPORTED;
import static smetana.core.debug.SmetanaDebug.ENTERING;
import static smetana.core.debug.SmetanaDebug.LEAVING;

import gen.annotation.Original;
import gen.annotation.Reviewed;
import gen.annotation.Unused;
import h.ST_Agraph_s;
import h.ST_boxf;
import h.ST_pointf;
import smetana.core.CArray;
import smetana.core.CString;
import smetana.core.Globals;
import smetana.core.ZType;
import smetana.core.__ptr__;

public class emit__c {




@Reviewed(when = "12/11/2020")
@Original(version="2.38.0", path="lib/common/emit.c", name="init_xdot", key="7udip7yo3ddkp9ocjftokpm9y", definition="void* init_xdot (Agraph_t* g)")
public static __ptr__ init_xdot(Globals zz, ST_Agraph_s g) {
ENTERING("7udip7yo3ddkp9ocjftokpm9y","init_xdot");
try {
    CString p;
    __ptr__ xd = null;
	if (!((p = agget(zz, g, new CString("_background")))!=null && p.charAt(0)!='\0')) {
	if (!((p = agget(zz, g, new CString("_draw_")))!=null  && p.charAt(0)!='\0')) {
	    return null;
	}
    }
UNSUPPORTED("16fu50ud9qppkwxzdy0nde3lm"); //     xd = parseXDotF (p, NULL, sizeof (exdot_op));
UNSUPPORTED("1x2xrqe9on9i2dlb07gj02n65"); //     if (!xd) {
UNSUPPORTED("b4emzm37tsv7edlai0fhwoul1"); // 	agerr(AGWARN, "Could not parse \"_background\" attribute in graph %s\n", agnameof(g));
UNSUPPORTED("72v3r8ey2hvh1o9qskrji8im4"); // 	agerr(AGPREV, "  \"%s\"\n", p);
UNSUPPORTED("dvgyxsnyeqqnyzq696k3vskib"); //     }
UNSUPPORTED("jujeh27uxxeyas8n09tnlnbu"); //     return xd;
UNSUPPORTED("c24nfmv9i7o5eoqaymbibp7m7"); // }

throw new UnsupportedOperationException();
} finally {
LEAVING("7udip7yo3ddkp9ocjftokpm9y","init_xdot");
}
}



/* check_control_points:
 * check_control_points function checks the size of quadrilateral
 * formed by four control points
 * returns 1 if four points are in line (or close to line)
 * else return 0
 */
//3 7nqmdkcnal35ollpstkk707t8
// static int check_control_points(pointf *cp) 
@Unused
@Original(version="2.38.0", path="lib/common/emit.c", name="check_control_points", key="7nqmdkcnal35ollpstkk707t8", definition="static int check_control_points(pointf *cp)")
public static boolean check_control_points(CArray cp) {
ENTERING("7nqmdkcnal35ollpstkk707t8","check_control_points");
try {
    double dis1 = ptToLine2 (cp.get__(0), cp.get__(3), cp.get__(1));
    double dis2 = ptToLine2 (cp.get__(0), cp.get__(3), cp.get__(2));
    if (dis1 < 2.0*2.0 && dis2 < 2.0*2.0)
        return true;
    else
        return false;
} finally {
LEAVING("7nqmdkcnal35ollpstkk707t8","check_control_points");
}
}




/* update bounding box to contain a bezier segment */
//3 5wldemr88fdxl6101ugewclw9
// void update_bb_bz(boxf *bb, pointf *cp) 
@Unused
@Original(version="2.38.0", path="lib/common/emit.c", name="update_bb_bz", key="5wldemr88fdxl6101ugewclw9", definition="void update_bb_bz(boxf *bb, pointf *cp)")
public static void update_bb_bz(ST_boxf bb, CArray cp) {
ENTERING("5wldemr88fdxl6101ugewclw9","update_bb_bz");
try {
    /* if any control point of the segment is outside the bounding box */
    if (cp.get__(0).x > bb.UR.x || cp.get__(0).x < bb.LL.x ||
        cp.get__(0).y > bb.UR.y || cp.get__(0).y < bb.LL.y ||
        cp.get__(1).x > bb.UR.x || cp.get__(1).x < bb.LL.x ||
        cp.get__(1).y > bb.UR.y || cp.get__(1).y < bb.LL.y ||
        cp.get__(2).x > bb.UR.x || cp.get__(2).x < bb.LL.x ||
        cp.get__(2).y > bb.UR.y || cp.get__(2).y < bb.LL.y ||
        cp.get__(3).x > bb.UR.x || cp.get__(3).x < bb.LL.x ||
        cp.get__(3).y > bb.UR.y || cp.get__(3).y < bb.LL.y) {
    	
        /* if the segment is sufficiently refined */
        if (check_control_points(cp)) {        
            int i;
            /* expand the bounding box */
            for (i = 0; i < 4; i++) {
                if (cp.get__(i).x > bb.UR.x)
                    bb.UR.x = cp.get__(i).x;
                else if (cp.get__(i).x < bb.LL.x)
                    bb.LL.x = cp.get__(i).x;
                if (cp.get__(i).y > bb.UR.y)
                    bb.UR.y = cp.get__(i).y;
                else if (cp.get__(i).y < bb.LL.y)
                    bb.LL.y = cp.get__(i).y;
            }
        }
        else { /* else refine the segment */
		    final CArray left = CArray.ALLOC__(4, ZType.ST_pointf);
		    final CArray right = CArray.ALLOC__(4, ZType.ST_pointf);
            Bezier (cp, 3, 0.5, left, right);
            update_bb_bz(bb, left);
            update_bb_bz(bb, right);
        }
    }
} finally {
LEAVING("5wldemr88fdxl6101ugewclw9","update_bb_bz");
}
}




@Reviewed(when = "11/11/2020")
@Original(version="2.38.0", path="lib/common/emit.c", name="gv_fixLocale", key="31vgctm6ydke1b6e0s06x85og", definition="void gv_fixLocale (int set)")
public static void gv_fixLocale(int set) {
ENTERING("31vgctm6ydke1b6e0s06x85og","gv_fixLocale");
try {
	// System.out.println("SKIPPING gv_fixLocale");
} finally {
LEAVING("31vgctm6ydke1b6e0s06x85og","gv_fixLocale");
}
}



}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy