• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Display2D类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中sim.display.Display2D的典型用法代码示例。如果您正苦于以下问题:Java Display2D类的具体用法?Java Display2D怎么用?Java Display2D使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Display2D类属于sim.display包,在下文中一共展示了Display2D类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: setupPortrayal

import sim.display.Display2D; //导入依赖的package包/类
private Display2D setupPortrayal(FishState state, final ColorfulGrid portrayal) {
    portrayal.initializeGrid(state.getBiology(), state.getMap().getAllSeaTilesExcludingLandAsList() );

    portrayal.setField(state.getRasterBathymetry().getGrid());
    portrayal.setMap(new TriColorMap(-6000, 0, 6000, Color.BLUE, Color.CYAN, Color.GREEN, Color.RED));

    //now deal with display2d
    //change width and height to keep correct geographical ratio
    double width;
    double height;
    double heightToWidthRatio = ((double) state.getRasterBathymetry().getGridHeight())/state.getRasterBathymetry().getGridWidth();
    if(heightToWidthRatio >= 1)
    {
        width = MIN_DIMENSION;
        height = MIN_DIMENSION * heightToWidthRatio;
    }
    else
    {
        width = MIN_DIMENSION / heightToWidthRatio;
        height = MIN_DIMENSION;
    }
    return new Display2D(width, height, this);
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:24,代码来源:HeatmapTester.java


示例2: setupPortrayal

import sim.display.Display2D; //导入依赖的package包/类
public Display2D setupPortrayal(final ColorfulGrid portrayal) {
    FishState model = (FishState) state;
    portrayal.initializeGrid(model.getBiology(), model.getMap().getAllSeaTilesExcludingLandAsList());

    portrayal.setField(model.getRasterBathymetry().getGrid());
    portrayal.setMap(new TriColorMap(-6000, 0, 6000, Color.BLUE, Color.CYAN, Color.GREEN, Color.RED));

    //now deal with display2d
    //change width and height to keep correct geographical ratio
    double width;
    double height;
    double heightToWidthRatio = ((double) model.getRasterBathymetry().getGridHeight())/model.getRasterBathymetry().getGridWidth();
    if(heightToWidthRatio >= 1)
    {
        width = MIN_DIMENSION;
        height = MIN_DIMENSION * heightToWidthRatio;
    }
    else
    {
        width = MIN_DIMENSION / heightToWidthRatio;
        height = MIN_DIMENSION;
    }
    return new Display2D(width, height, this);
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:25,代码来源:FishGUI.java


示例3: setupDisplay2D

import sim.display.Display2D; //导入依赖的package包/类
public JFrame setupDisplay2D(
        final ColorfulGrid portrayal,
        final Display2D display, final String title,
        boolean addColorSwitcher) {
    FishState model = (FishState) state;
    if(addColorSwitcher)
        ((JComponent) display.getComponent(0)).add(
                new ColorfulGridSwitcher(portrayal, model.getBiology(), display));
    display.reset();
    display.setBackdrop(Color.WHITE);
    display.repaint();
    //attach it the portrayal
    display.attach(portrayal, "Bathymetry");

    displayFrame = display.createFrame();
    controller.registerFrame(displayFrame);
    displayFrame.setTitle(title);

    return displayFrame;
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:21,代码来源:FishGUI.java


示例4: init

import sim.display.Display2D; //导入依赖的package包/类
@Override
public void init(Controller c) {
	super.init(c);

	// make the displayer
	display = new Display2D(600, 600, this);
	// turn off clipping
	display.setClipping(false);

	displayFrame = display.createFrame();
	displayFrame.setTitle("Network Cooperation Display");
	c.registerFrame(displayFrame); // register the frame so it appears in
									// the "Display" list
	displayFrame.setVisible(true);
	display.attach(networkPortrayal, "Agents");

}
 
开发者ID:rwth-acis,项目名称:REST-OCD-Services,代码行数:18,代码来源:SimulationWithUI.java


示例5: Scenario2DPortrayal

import sim.display.Display2D; //导入依赖的package包/类
/**
 * The constructor needs the scenario and the size of the simulation
 * 
 * @param scenario
 * @param width
 * @param height
 * @throws DuplicatedPortrayalIDException
 */
public Scenario2DPortrayal(Scenario scenario, int width, int height)
        throws ShanksException {
    super(scenario);
    this.devices = new Continuous2D(5, width, height);
    this.links = new Network();
    this.deviceLinkNetwork = new SpatialNetwork2D(this.devices, this.links);
    this.displayList = new HashMap<String, Display2D>();
    this.frameList = new HashMap<String, JFrame>();
    ContinuousPortrayal2D devicesPortrayal = new ContinuousPortrayal2D();
    NetworkPortrayal2D linksPortrayal = new NetworkPortrayal2D();

    devicesPortrayal.setField(this.devices);
    linksPortrayal.setField(this.deviceLinkNetwork);

    this.addPortrayal(Scenario2DPortrayal.MAIN_DISPLAY_ID,
            ScenarioPortrayal.DEVICES_PORTRAYAL, devicesPortrayal);
    this.addPortrayal(Scenario2DPortrayal.MAIN_DISPLAY_ID,
            ScenarioPortrayal.LINKS_PORTRAYAL, linksPortrayal);

    this.addPortrayals();
    this.placeElements();

}
 
开发者ID:gsi-upm,项目名称:Shanks,代码行数:32,代码来源:Scenario2DPortrayal.java


示例6: init

import sim.display.Display2D; //导入依赖的package包/类
public void init(Controller c){
	super.init(c);
	display = new Display2D(600,600,this);
	display.setClipping(false);
	displayFrame = display.createFrame();
	displayFrame.setTitle("Schoolyard Display");
	c.registerFrame(displayFrame); // so the frame appears in the "Display" list
	displayFrame.setVisible(true);
	display.attach( yardPortrayal, "Yard" );
}
 
开发者ID:EdgarLopezPhD,项目名称:PaySim,代码行数:11,代码来源:PaySimWithUI.java


示例7: init

import sim.display.Display2D; //导入依赖的package包/类
public void init(Controller c) {
  super.init(c);

  ProximitySimulation sim = (ProximitySimulation) state;
  display = new Display2D(sim.width, sim.height, this);
  display.setClipping(false);
  displayFrame = display.createFrame();
  c.registerFrame(displayFrame);   // register the frame so it appears in the "Display" list
  displayFrame.setVisible(true);
  display.attach(socialPortrayal, "Social");
  display.attach(spacePortrayal, "Space");  // attach the portrayals
}
 
开发者ID:casific,项目名称:murmur,代码行数:13,代码来源:ProximitySimulationWithGUI.java


示例8: setupDisplay2D

import sim.display.Display2D; //导入依赖的package包/类
private void setupDisplay2D(
        FishState state, final ColorfulGrid portrayal, final Display2D display, final String title) {
    ((JComponent) display.getComponent(0)).add(
            new ColorfulGridSwitcher(portrayal, state.getBiology(), display));
    display.reset();
    display.setBackdrop(Color.WHITE);
    display.repaint();
    //attach it the portrayal
    display.attach(portrayal, "Bathymetry");

    displayFrame = display.createFrame();
    controller.registerFrame(displayFrame);
    displayFrame.setTitle(title);
    displayFrame.setVisible(true);
}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:16,代码来源:HeatmapTester.java


示例9: MPADrawer

import sim.display.Display2D; //导入依赖的package包/类
public MPADrawer(
        Display2D fishGUI,
        CoordinateTransformer transformer, NauticalMap map,
        FastObjectGridPortrayal2D mapPortrayal, FishGUI scheduler)
{
    this.fishDisplay = fishGUI;
    this.transformer =transformer;
    this.map = map;
    bathymetryPortrayal = mapPortrayal;
    this.scheduler = scheduler;


}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:14,代码来源:MPADrawer.java


示例10: init

import sim.display.Display2D; //导入依赖的package包/类
@Override
public void init(final Controller c) {
   super.init(c);
   
   final int
      screenWidth = (int) Math.round(Toolkit.getDefaultToolkit().getScreenSize().getWidth()),
      screenHeight = (int) Math.round(Toolkit.getDefaultToolkit().getScreenSize().getHeight()),
      graphFrameWidth = screenWidth / 2,
      graphFrameHeight = screenHeight / 2;
   
   // Graphs
   chartFrame = new JFrame("Model Statistics [" + modelName + "]");
   c.registerFrame(chartFrame);
   chartFrame.pack();
   chartFrame.setSize(graphFrameWidth, graphFrameHeight);
   chartFrame.setVisible(true);
   
   // Component Visualization
   final Display2D display = new Display2D(screenWidth / 4, screenHeight / 4, this);
   display.setClipping(false);
   subEconomyVisualizationFrame = display.createFrame();
   subEconomyVisualizationFrame.setTitle("Components");
   c.registerFrame(subEconomyVisualizationFrame);
   subEconomyVisualizationFrame.pack();
   subEconomyVisualizationFrame.setVisible(true);
   
   final JTabbedPane tabbedPane = new JTabbedPane();
   chartFrame.add(tabbedPane);
   setupCharts();
   addTabs(tabbedPane);
   
   final Console console = getConsole();
   
   console.setLocation(chartFrame.getLocationOnScreen().x + chartFrame.getWidth(), 0);
   console.setSize(150, graphFrameHeight);
   
}
 
开发者ID:crisis-economics,项目名称:CRISIS,代码行数:38,代码来源:MasterModelGUI.java


示例11: addDisplay

import sim.display.Display2D; //导入依赖的package包/类
/**
 * Add a display to the simulation
 * 
 * @param displayID
 * @param display
 * @throws DuplictaedDisplayIDException
 * @throws DuplicatedPortrayalIDException
 * @throws ScenarioNotFoundException
 */
public void addDisplay(String displayID, Display2D display)
        throws ShanksException {
    Scenario2DPortrayal scenarioPortrayal = (Scenario2DPortrayal) this
            .getSimulation().getScenarioPortrayal();
    HashMap<String, Display2D> displays = scenarioPortrayal.getDisplays();
    if (!displays.containsKey(displayID)) {
        displays.put(displayID, display);
    } else {
        throw new DuplictaedDisplayIDException(displayID);
    }
}
 
开发者ID:gsi-upm,项目名称:Shanks,代码行数:21,代码来源:ShanksSimulation2DGUI.java


示例12: removeDisplay

import sim.display.Display2D; //导入依赖的package包/类
/**
 * Remove a display from the simulation
 * 
 * @param displayID
 * @throws ScenarioNotFoundException
 * @throws DuplicatedPortrayalIDException
 */
public void removeDisplay(String displayID) throws ShanksException {
    Scenario2DPortrayal scenarioPortrayal = (Scenario2DPortrayal) this
            .getSimulation().getScenarioPortrayal();
    HashMap<String, Display2D> displays = scenarioPortrayal.getDisplays();
    if (displays.containsKey(displayID)) {
        displays.remove(displayID);
    }
}
 
开发者ID:gsi-upm,项目名称:Shanks,代码行数:16,代码来源:ShanksSimulation2DGUI.java


示例13: addDisplay

import sim.display.Display2D; //导入依赖的package包/类
/**
 * @param displayID
 * @param display
 * @throws DuplictaedDisplayIDException
 */
public void addDisplay(String displayID, Display2D display)
        throws ShanksException {
    if (this.displayList.containsKey(displayID)) {
        throw new DuplictaedDisplayIDException(displayID);
    }
    this.displayList.put(displayID, display);
}
 
开发者ID:gsi-upm,项目名称:Shanks,代码行数:13,代码来源:Scenario2DPortrayal.java


示例14: addDisplays

import sim.display.Display2D; //导入依赖的package包/类
public void addDisplays(Scenario2DPortrayal scenarioPortrayal) {
    Display2D failureDisplay = new Display2D(600, 100, this);
    try {
        this.addDisplay(
                MyHyperComplexScenario2DPortrayal.FAILURE_DISPLAY_ID,
                failureDisplay);
    } catch (Exception e) {
        e.printStackTrace();
    }
}
 
开发者ID:gsi-upm,项目名称:Shanks,代码行数:11,代码来源:MyShanksSimulation2DGUI.java


示例15: getDisplay

import sim.display.Display2D; //导入依赖的package包/类
public Display2D getDisplay() {
	return display;
}
 
开发者ID:EdgarLopezPhD,项目名称:PaySim,代码行数:4,代码来源:PaySimWithUI.java


示例16: setDisplay

import sim.display.Display2D; //导入依赖的package包/类
public void setDisplay(Display2D display) {
	this.display = display;
}
 
开发者ID:EdgarLopezPhD,项目名称:PaySim,代码行数:4,代码来源:PaySimWithUI.java


示例17: CoordinateTransformer

import sim.display.Display2D; //导入依赖的package包/类
public CoordinateTransformer(Display2D mapDisplay, NauticalMap map) {
    this.display = mapDisplay;
    this.map = map;

}
 
开发者ID:CarrKnight,项目名称:POSEIDON,代码行数:6,代码来源:CoordinateTransformer.java


示例18: init

import sim.display.Display2D; //导入依赖的package包/类
@Override
public void init(Controller controller) {
    super.init(controller);
    testDisplay = new Display2D(600,600,this);
    testDisplay.setClipping(false);
    displayFrame = testDisplay.createFrame();
    controller.registerFrame(displayFrame);
    displayFrame.setVisible(true);


    //initialize the selector
    Bag inspectors = new Bag(1); inspectors.add(Scenario.scenarioSelector(state));
    Bag names = new Bag(1); names.add("Scenario controller");
    controller.setInspectors(inspectors,names);




}
 
开发者ID:CarrKnight,项目名称:MacroIIDiscrete,代码行数:20,代码来源:MacroIIGUI.java


示例19: init

import sim.display.Display2D; //导入依赖的package包/类
public void init(Controller c) {

		super.init(c);

		// Configure display 2D
		this.display2D = new Display2D(200,
				200, this);
//		this.display2D = new Display2D(this.simulation.getNetworkDimension(),
//				this.simulation.getNetworkDimension(), this);
		this.display2D.setScale(3);
		this.display2D.setClipping(false);
		this.networkFrame2D = this.display2D.createFrame();
		this.networkFrame2D.setTitle("Twitter - 2D");
		c.registerFrame(this.networkFrame2D);
		this.networkFrame2D.setVisible(true);

		this.display2D.attach(this.networkPortrayal2D, "Links");
		this.display2D.attach(this.usersPortrayal2D, "Users");

		// Configure display 3D
		this.display3D = new Display3D(600,
				600, this);
//		this.display3D = new Display3D(this.simulation.getNetworkDimension(),
//				this.simulation.getNetworkDimension(), this);
		this.display3D.scale(0.01);
		this.display3D.setBackdrop(Color.white);
		this.networkFrame3D = this.display3D.createFrame();
		this.networkFrame3D.setTitle("Twitter - 3D");
		c.registerFrame(this.networkFrame3D);
		this.networkFrame3D.setVisible(true);
		this.display3D.setShowsAxes(false);

		this.display3D.attach(this.networkPortrayal3D, "Links");
		this.display3D.attach(this.usersPortrayal3D, "Users");

		// Prepare displays
		this.display2D.reset();
		this.display2D.setBackdrop(Color.white);
		this.display2D.repaint();
		this.networkFrame2D.setLocation(100, 100);

		this.display3D.reset();
		this.display3D.setBackdrop(Color.white);
		this.display3D.repaint();
		this.networkFrame3D.setLocation(300, 300);

	}
 
开发者ID:gsi-upm,项目名称:TwitterSimulator,代码行数:48,代码来源:TwitterSimulationGUI.java


示例20: getDisplay2D

import sim.display.Display2D; //导入依赖的package包/类
/**
 * @return the display2D
 */
public Display2D getDisplay2D() {
	return display2D;
}
 
开发者ID:gsi-upm,项目名称:TwitterSimulator,代码行数:7,代码来源:TwitterSimulationGUI.java



注:本文中的sim.display.Display2D类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java GetUserMappingsProtocolPB类代码示例发布时间:2022-05-22
下一篇:
Java RpcClientFactoryPBImpl类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap