本文整理汇总了Java中processing.data.XML.getInt方法的典型用法代码示例。如果您正苦于以下问题:Java XML.getInt方法的具体用法?Java XML.getInt怎么用?Java XML.getInt使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类processing.data.XML
的用法示例。
在下文中一共展示了XML.getInt方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: loadFrom
import processing.data.XML; //导入方法依赖的package包/类
@Override
public void loadFrom(PApplet parent, String fileName) {
XML root = parent.loadXML(fileName);
XML resolutionNode = root.getChild(RESOLUTION_XML_NAME);
this.width = resolutionNode.getInt(WIDTH_XML_NAME);
this.height = resolutionNode.getInt(HEIGHT_XML_NAME);
XML intrinsicsNode = root.getChild(INTRINSICS_XML_NAME);
getMatFrom(intrinsicsNode, intrinsics);
XML extrinsicsNode = root.getChild(EXTRINSICS_XML_NAME);
if (extrinsicsNode == null) {
this.hasExtrinsics = false;
return;
}
getMatFrom(extrinsicsNode, extrinsics);
checkExtrinsics();
}
示例2: loadFrom
import processing.data.XML; //导入方法依赖的package包/类
@Override
public void loadFrom(PApplet parent, String fileName) {
XML root = parent.loadXML(fileName);
XML resolutionNode = root.getChild(RESOLUTION_XML_NAME);
this.width = resolutionNode.getInt(WIDTH_XML_NAME);
this.height = resolutionNode.getInt(HEIGHT_XML_NAME);
XML intrinsicsNode = root.getChild(INTRINSICS_XML_NAME);
getMatFrom(intrinsicsNode, intrinsics);
XML extrinsicsNode = root.getChild(EXTRINSICS_XML_NAME);
if(extrinsicsNode == null){
this.hasExtrinsics = false;
return;
}
getMatFrom(extrinsicsNode, extrinsics);
checkExtrinsics();
}
示例3: readModelStep
import processing.data.XML; //导入方法依赖的package包/类
public void readModelStep(Model model, XML element,ModelDomain md){
int s=-1; if(element.hasAttribute("Number")) s=element.getInt("Number");
int hpf=-1; if(element.hasAttribute("hpf")) hpf=element.getInt("hpf");
int d=-1; if(element.hasAttribute("Draw")) d=element.getInt("Draw");
if(s>=0){
model.step=p.max(model.step,s);
model.ActualStep=model.step;
model.Correspons[s]=hpf;
XML[]children=element.getChildren();
for(int j=0;j<children.length;j++)
if(children[j].getName().equals("Gene"))
readModelGene(children[j], md, s);
} else p.mm.addMessage("We didn't fint step number " );
}
示例4: FontGlyph
import processing.data.XML; //导入方法依赖的package包/类
public FontGlyph(final PShapeSVG parent, final XML properties, final Font font) {
super(parent, properties, true);
super.parsePath(); // ??
name = properties.getString("glyph-name");
final String u = properties.getString("unicode");
unicode = 0;
if (u != null) {
if (u.length() == 1) {
unicode = u.charAt(0);
// System.out.println("unicode for " + name + " is " + u);
} else {
System.err.println("unicode for " + name + " is more than one char: " + u);
}
}
if (properties.hasAttribute("horiz-adv-x")) {
horizAdvX = properties.getInt("horiz-adv-x");
} else {
horizAdvX = font.horizAdvX;
}
}
示例5: loadTmxProperties
import processing.data.XML; //导入方法依赖的package包/类
private void loadTmxProperties(XML e){
this.version = e.getFloat("version");
this.orientation = e.getString("orientation");
this.renderorder = e.getString("renderorder");
this.mapwidth = e.getInt("width");
this.mapheight = e.getInt("height");
this.tilewidth = e.getInt("tilewidth");
this.tileheight = e.getInt("tileheight");
this.staggerindex = 0; if(e.hasAttribute("staggerindex")) if(e.getString("staggerindex").equals("even")) this.staggerindex = 1;
this.staggeraxis = "x"; if(e.hasAttribute("staggeraxis")) this.staggeraxis = e.getString("staggeraxis");
this.hexsidelength = 0; if(e.hasAttribute("hexsidelength")) this.hexsidelength = e.getInt("hexsidelength");
this.backgroundcolor = parent.color(80, 80, 80); if(e.hasAttribute("backgroundcolor")) this.backgroundcolor = this.readColor(e.getString("backgroundcolor"));
}
示例6: getFrom
import processing.data.XML; //导入方法依赖的package包/类
private void getFrom(XML xml) {
maximumDistance = xml.getFloat(MAX_DIST_XML_NAME);
minimumComponentSize = xml.getInt(MIN_COPO_SIZE_XML_NAME);
minimumHeight = xml.getFloat(MIN_HEIGHT_XML_NAME);
maximumRecursion = xml.getInt(MAX_RECURSION_XML_NAME);
searchDepth = xml.getInt(SEARCH_DEPTH_XML_NAME);
precision = xml.getInt(PRECISION_XML_NAME);
trackingForgetTime = xml.getInt(TRACKING_FORGET_TIME_XML_NAME);
trackingMaxDistance = xml.getFloat(TRACKING_MAX_DIST_TIME_XML_NAME);
}
示例7: ReadDomains
import processing.data.XML; //导入方法依赖的package包/类
public void ReadDomains(XML element){
String domains_format_field = "format";
int domains_format = element.getInt(domains_format_field, 0);
XML[]children=element.getChildren();
for(int j=0;j<children.length;j++){
if(children[j].getName().equals("Domain")) ReadDomain(children[j]);
}
}
示例8: ReadDomain
import processing.data.XML; //导入方法依赖的package包/类
public void ReadDomain(XML element) {
int version = element.getInt("version", 1);
if (version == 1) {
ReadDomainV1(element);
}
else if (version == 2) {
ReadDomainV2(element);
}
else {
p.mm.addMessage("Skipping domain - found version \'" + version + "\'");
}
}
示例9: ReadDomainV2
import processing.data.XML; //导入方法依赖的package包/类
public void ReadDomainV2(XML element) {
String name = element.getString("name");
// Create the domain object
Domain domain = findOrCreateDomain(name);
// Read ancestors
for (XML ancestor : element.getChild("ancestors").getChildren("ancestor")) {
String ancestorName = ancestor.getString("name");
domain.addTree(ancestorName);
}
// Read spatial relations
XML definition = element.getChild("definition");
ArrayList<Objet[]> relations = new ArrayList<Objet[]>();
for (XML spatial : definition.getChildren("spatial")) {
String type = spatial.getString("type");
int min = spatial.getInt("min");
int max = spatial.getInt("max");
String targetDomain = spatial.getString("domain");
relations.add(createSpatialRelation(type, min, max, targetDomain));
}
Objet[][] result = new Objet[relations.size()][2];
for (int i = 0; i < relations.size(); i++) {
result[i] = relations.get(i);
}
domain.DefObjets = result;
}
示例10: readMenu
import processing.data.XML; //导入方法依赖的package包/类
public void readMenu(XML element){
if(element.hasAttribute("Number")) {
int num=element.getInt("Number");
if(element.hasAttribute("OriginX")) p.mm.OrginMenuXY[num][0]=element.getInt("OriginX");
if(element.hasAttribute("OriginY")) p.mm.OrginMenuXY[num][1]=element.getInt("OriginY");
if(element.hasAttribute("SizeX")) p.mm.SizeMenuXY[num][0]=element.getInt("SizeX");
if(element.hasAttribute("SizeY")) p.mm.SizeMenuXY[num][1]=element.getInt("SizeY");
if(element.hasAttribute("Active")) p.mm.MenuActive[num]=p.parseInt(element.getString("Active"));
}
}
示例11: Font
import processing.data.XML; //导入方法依赖的package包/类
public Font(final PShapeSVG parent, final XML properties) {
super(parent, properties, false);
// handle(parent, properties);
final XML[] elements = properties.getChildren();
horizAdvX = properties.getInt("horiz-adv-x", 0);
namedGlyphs = new HashMap<String, FontGlyph>();
unicodeGlyphs = new HashMap<Character, FontGlyph>();
glyphCount = 0;
glyphs = new FontGlyph[elements.length];
for (final XML elem : elements) {
final String name = elem.getName();
if (name == null) {
// skip it
} else if (name.equals("glyph")) {
final FontGlyph fg = new FontGlyph(this, elem, this);
if (fg.isLegit()) {
if (fg.name != null) {
namedGlyphs.put(fg.name, fg);
}
if (fg.unicode != 0) {
unicodeGlyphs.put(new Character(fg.unicode), fg);
}
}
glyphs[glyphCount++] = fg;
} else if (name.equals("missing-glyph")) {
// System.out.println("got missing glyph inside <font>");
missingGlyph = new FontGlyph(this, elem, this);
} else if (name.equals("font-face")) {
face = new FontFace(this, elem);
} else {
System.err.println("Ignoring " + name + " inside <font>");
}
}
}
示例12: loadTileset
import processing.data.XML; //导入方法依赖的package包/类
private void loadTileset(XML e){
XML c;
if(e.hasAttribute("source") && e.getChild("image") == null){
loadTileset(parent.loadXML(e.getString("source")));
return;
}
int tilewidth = e.getInt("tilewidth");
int tileheight = e.getInt("tileheight");
int tilecount = 0;
int columns = 0;
int spacing = 0;
int margin = 0;
int tileoffsetx = 0;
int tileoffsety = 0;
PImage source, image;
if(e.hasAttribute("tilecount")) tilecount = e.getInt("tilecount");
if(e.hasAttribute("columns")) columns = e.getInt("columns");
if(e.hasAttribute("spacing")) spacing = e.getInt("spacing");
if(e.hasAttribute("margin")) margin = e.getInt("margin");
c = e.getChild("tileoffset");
if(c != null) {
tileoffsetx = c.getInt("x");
tileoffsety = c.getInt("y");
}
c = e.getChild("image");
if(c != null) {
source = parent.loadImage(c.getString("source"));
if(columns == 0) columns = parent.floor((source.width - margin) / (tilewidth + spacing));
if(tilecount == 0) tilecount = columns * parent.floor((source.height - margin) / (tileheight + spacing));
if(c.hasAttribute("trans")) this.applyTransColor(source, c.getString("trans"));
for(int n = 0; n < tilecount; n++){
image = source.get(margin + (n % columns) * (tilewidth + spacing), margin + parent.floor(n / columns) * (tileheight + spacing), tilewidth, tileheight);
this.tile = (Tile[])parent.append(this.tile, new Tile(image, tileoffsetx, tileoffsety));
}
}
else{
XML cs[] = e.getChildren("tile");
if(cs != null){
for(XML t: cs){
image = parent.loadImage(t.getChild("image").getString("source"));
this.tile = (Tile[])parent.append(this.tile, new Tile(image, tileoffsetx, tileoffsety));
}
}
}
}
示例13: get
import processing.data.XML; //导入方法依赖的package包/类
private int get(XML root, String name) {
return root.getInt(name);
}
示例14: loadScreenFrom
import processing.data.XML; //导入方法依赖的package包/类
private void loadScreenFrom(XML screenNode) {
this.projectionScreenWidth = screenNode.getInt(SCREEN_WIDTH_XML_NAME);
this.projectionScreenHeight = screenNode.getInt(SCREEN_HEIGHT_XML_NAME);
this.projectionScreenOffsetX = screenNode.getInt(SCREEN_OFFSET_X_XML_NAME);
this.projectionScreenOffsetY = screenNode.getInt(SCREEN_OFFSET_Y_XML_NAME);
}
示例15: loadKeyBindings
import processing.data.XML; //导入方法依赖的package包/类
/**
* Load specified key bindings from the XML resource
*
* @param xml
*/
public void loadKeyBindings(XML xml) {
XML[] bindings = xml.getChildren();
for(XML binding : bindings) {
//Make sure that this is a "binding" element
if(!binding.getName().equals("binding"))
continue;
//Parse the key binding
String name = binding.getContent();
int key = binding.getInt("key");
//Load the list of possible key modifiers
String modifiers = binding.getString("mod");
String[] mods = modifiers.split("\\|"); // "|" is a REGEX keyword... need to escape it
//The possible modifiers (these are available in API level 11+)
boolean ctrl = false;
boolean meta = false;
boolean func = false;
// (and these are available across all API levels)
boolean alt = false;
boolean sym = false;
boolean shift = false;
//This isn't very elegant... but it gets the job done
for(String mod : mods) {
if(mod.equals("ctrl")) ctrl = true;
if(mod.equals("meta")) meta = true;
if(mod.equals("func")) func = true;
if(mod.equals("alt")) alt = true;
if(mod.equals("sym")) sym = true;
if(mod.equals("shift")) shift = true;
}
//Build the KeyBinding
KeyBinding bind = new KeyBinding(name, key, ctrl, meta, func, alt, sym, shift);
//Add the key binding
keyBindings.put(name, bind);
}
}