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

gen.lib.gvc.gvlayout__c Maven / Gradle / Ivy

Go to download

PlantUML is a component that allows to quickly write : * sequence diagram, * use case diagram, * class diagram, * activity diagram, * component diagram, * state diagram * object diagram

There is a newer version: 8059
Show newest version
/* ========================================================================
 * PlantUML : a free UML diagram generator
 * ========================================================================
 *
 * 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/paypal
 * 
 * This file is part of Smetana.
 * Smetana is a partial translation of Graphviz/Dot sources from C to Java.
 *
 * (C) Copyright 2009-2022, Arnaud Roques
 *
 * This translation is distributed under the same Licence as the original C program:
 * 
 *************************************************************************
 * Copyright (c) 2011 AT&T Intellectual Property 
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors: See CVS logs. Details at http://www.graphviz.org/
 *************************************************************************
 *
 * THE ACCOMPANYING PROGRAM IS PROVIDED UNDER THE TERMS OF THIS ECLIPSE PUBLIC
 * LICENSE ("AGREEMENT"). [Eclipse Public License - v 1.0]
 * 
 * ANY USE, REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES
 * RECIPIENT'S ACCEPTANCE OF THIS AGREEMENT.
 * 
 * You may obtain a copy of the License at
 * 
 * http://www.eclipse.org/legal/epl-v10.html
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 */
package gen.lib.gvc;
import static gen.lib.cgraph.obj__c.agroot;
import static gen.lib.cgraph.rec__c.agbindrec;
import static gen.lib.common.emit__c.gv_fixLocale;
import static gen.lib.common.input__c.graph_init;
import static smetana.core.JUtils.LOG2;
import static smetana.core.Macro.GD_cleanup;
import static smetana.core.Macro.GD_drawing;
import static smetana.core.Macro.GD_gvc;
import static smetana.core.Macro.GVRENDER_PLUGIN;
import static smetana.core.Macro.LAYOUT_USES_RANKDIR;
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 h.EN_layout_type;
import h.ST_Agraph_s;
import h.ST_GVC_s;
import h.ST_gvlayout_engine_s;
import h.ST_gvlayout_features_t;
import h.ST_gvplugin_installed_t;
import smetana.core.CString;
import smetana.core.Globals;
import smetana.core.ZType;
import smetana.core.size_t;

public class gvlayout__c {


private final static ST_gvlayout_features_t dotgen_features = new ST_gvlayout_features_t();
private final static ST_gvlayout_engine_s dotgen_engine = new ST_gvlayout_engine_s();
static {
	dotgen_features.flags = LAYOUT_USES_RANKDIR;
	dotgen_engine.layout = gen.lib.dotgen.dotinit__c.dot_layout;
	dotgen_engine.cleanup = gen.lib.dotgen.dotinit__c.dot_cleanup;
}



@Reviewed(when = "11/11/2020")
@Original(version="2.38.0", path="lib/gvc/gvlayout.c", name="gvlayout_select", key="2g20jitdi8afuoei8p1mcfg9l", definition="int gvlayout_select(GVC_t * gvc, const char *layout)")
public static int gvlayout_select(ST_GVC_s gvc, CString layout) {
ENTERING("2g20jitdi8afuoei8p1mcfg9l","gvlayout_select");
try {
	ST_gvplugin_installed_t gvlayout_dot_layout = new ST_gvplugin_installed_t();
	gvlayout_dot_layout.id = EN_layout_type.LAYOUT_DOT;
	gvlayout_dot_layout.type = new CString("dot");
	gvlayout_dot_layout.quality = 0;
	gvlayout_dot_layout.engine = dotgen_engine;
	gvlayout_dot_layout.features = dotgen_features;

//    gvplugin_available_t *plugin;
	ST_gvplugin_installed_t typeptr = gvlayout_dot_layout;
//    plugin = gvplugin_load(gvc, API_layout, layout);
//    if (plugin) {
//	typeptr = plugin->typeptr;
	gvc.layout.type = typeptr.type;
	gvc.layout.engine = typeptr.engine;
	gvc.layout.id = typeptr.id;
	gvc.layout.features = typeptr.features;
	return GVRENDER_PLUGIN;  /* FIXME - need better return code */
//    }
//    return 999;
} finally {
LEAVING("2g20jitdi8afuoei8p1mcfg9l","gvlayout_select");
}
}




@Reviewed(when = "11/11/2020")
@Original(version="2.38.0", path="lib/gvc/gvlayout.c", name="gvLayoutJobs", key="991b7t7n0x8ifkp49zotjs78x", definition="int gvLayoutJobs(GVC_t * gvc, Agraph_t * g)")
public static int gvLayoutJobs(Globals zz, ST_GVC_s gvc, ST_Agraph_s g) {
ENTERING("991b7t7n0x8ifkp49zotjs78x","gvLayoutJobs");
try {
	ST_gvlayout_engine_s gvle;
    CString p = null;
    int rc;
    agbindrec(zz, g, new CString("Agraphinfo_t"), new size_t(ZType.ST_Agraphinfo_t), true);
    GD_gvc(g, gvc);
    if ((g != agroot(g)))
UNSUPPORTED("ah9ygbaap1fyxr97z734juk0j"); // 	GD_gvc(agroot(g)) = gvc;
/*    if ((p = agget(g, new CString("layout")))!=null) {
UNSUPPORTED("dlm1jil8gt2pv7p8yrit1tuls"); //         gvc->layout.engine = NULL;
UNSUPPORTED("efl8rjna6ij4qjxb0xlyu3hh1"); // 	rc = gvlayout_select(gvc, p);
UNSUPPORTED("7smbmph5nldinro02iqf3qlxv"); // 	if (rc == 999) {
UNSUPPORTED("6ru23qpjrx893ivwviirr1ikc"); // 	    agerr (AGERR, "Layout type: \"%s\" not recognized. Use one of:%s\n",
UNSUPPORTED("f3vrr10ga3mqymh2qxomxn326"); // 	        p, gvplugin_list(gvc, API_layout, p));
UNSUPPORTED("aivfd7ajlfz8o8oi68d4u5s5z"); // 	    return -1;
UNSUPPORTED("flupwh3kosf3fkhkxllllt1"); // 	}
    }*/
    
    rc = gvlayout_select(gvc, p); //Let's force things
    
    gvle = (ST_gvlayout_engine_s) gvc.layout.engine;
    if ((gvle) == null)
	UNSUPPORTED("return -1;");
    
    
    gv_fixLocale (1);
    graph_init(zz, g, (gvc.layout.features.flags & LAYOUT_USES_RANKDIR)!=0);
    GD_drawing(agroot(g), GD_drawing(g));
    if (gvle!=null && gvle.layout!=null) {
	gvle.layout.exe(zz, g);

	
	
	if (gvle.cleanup!=null)
		if (GD_cleanup(g)==null) 
		LOG2("WARNING WE CHEAT GD_cleanup(g) is NULL"); else
	    GD_cleanup(g, gvle.cleanup);
    }
    gv_fixLocale (0);
    return 0;
} finally {
LEAVING("991b7t7n0x8ifkp49zotjs78x","gvLayoutJobs");
}
}





}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy