Quantcast

Re: Repast-interest Digest, Vol 124, Issue 5

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Repast-interest Digest, Vol 124, Issue 5

Ying Min Jin
Hello, Nick Collier.
Many thanks.
I have solved it. You are best Repast expert.
In future, I will contact with you.
Best regards.

Sent from Windows Mail

From: [hidden email]
Sent: ‎Friday‎, ‎September‎ ‎9‎, ‎2016 ‎5‎:‎24‎ ‎AM
To: [hidden email]

Send Repast-interest mailing list submissions to
 [hidden email]

To subscribe or unsubscribe via the World Wide Web, visit
 https://lists.sourceforge.net/lists/listinfo/repast-interest
or, via email, send a message with subject or body 'help' to
 [hidden email]

You can reach the person managing the list at
 [hidden email]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Repast-interest digest..."


Today's Topics:

   1. Re: Help me. (Nick Collier)
   2. problem with reading shapefile (Meshal Al-Harbi)
   3. cannot halt simulation (jlefur)


----------------------------------------------------------------------

Message: 1
Date: Wed, 7 Sep 2016 09:25:36 -0400
From: Nick Collier <[hidden email]>
Subject: Re: [Repast-interest] Help me.
To: Ying Min Jin <[hidden email]>
Cc: "[hidden email]"
 <[hidden email]>
Message-ID: <[hidden email]>
Content-Type: text/plain; charset="utf-8"

The demo model ?Mousetrap? includes a custom display. You can install the demo model in Simphony?s eclipse with File->Import Repast Examples.

All simphony displays implement IDisplay. In the mousetrap model, CustomDisplay.java is an example that displays a panel with a simple label in it. Note that most of the methods are empty or return null. The important methods are render, update and getPanel. When update is called the display should update its internal state to reflect the latest state of whatever its displaying. When render is called, the display should draw those updates. getPanel is called during initialization to put a panel into a display tab.

The next step then is telling simphony to load this display during initialization. You do that with a ModelInitializer. The model initializer is run once just after your scenario is loaded. It can be used to add additional items to the scenario tree that?s displayed on the left hand side of simphony. Its not immediately obvious but this is actually a tree of actions that simphony executes when it initializes a model prior to a run. A model initializer then can add a custom action that initializes a custom display. TrapInitializer.java does just that. The second added controller action is what sets up the custom display. Lastly, you need tell Simphony to run your ModelInitializer and you do that in the scenario.xml file located in your scenario directory (e.g. mousetrap.rs) by adding a model.initializer entry. For example,

?model.initializer class=?repast.simphony.demo.mousetrap.TrapInitializer??

Nick
> On Sep 6, 2016, at 11:56 AM, Ying Min Jin <[hidden email]> wrote:
>
> Hello.
> I am beginner for development on Repast.
> I have completed small Repast work with GIS. In fact, I am a GIS expert so I am interesting in the Repast.I would like to know the way for add new visualization and simulate on that.
> In this situation, one simulation was finished yet, and but I want to continue to make new simulation on new visualization. I want to know about the way for that programmatically add new display, new context and new agents, new schedule etc.
> I have finished like this.

>     JPanel incidentPanel=new JPanel();
>    RSApplication.getRSApplicationInstance().getGui().addVizualization("fire incident", incidentPanel);
>
> So new visualization was added. I want to draw new shapes with new agents.
> after, How I shall do it?
> I am looking forward at reply.
> Thank you.
>
>
> Sent from Windows Mail
>
> ------------------------------------------------------------------------------
> _______________________________________________
> Repast-interest mailing list
> [hidden email] <mailto:[hidden email]>
> https://lists.sourceforge.net/lists/listinfo/repast-interest <https://lists.sourceforge.net/lists/listinfo/repast-interest>
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 2
Date: Thu, 8 Sep 2016 16:50:20 +0100
From: Meshal Al-Harbi <[hidden email]>
Subject: [Repast-interest] problem with reading shapefile
To: [hidden email],
 [hidden email]
Message-ID:
 <CAPn5-zEkivbhm+QDyd_2KV0QvkU06ZknfL9cz8bXYjy90K+[hidden email]>
Content-Type: text/plain; charset="utf-8"

Hi folks,

I have a CSV file that contains a company name, lat, and long. I converted
this CSV file into a shapefile. When I add this shapefile into the model
from the display wizard, it puts all the companies at their right
locations. However, when I try to read the CSV file using this code it
gives extra companies right in the middle of the street which is not
possible. Basically it doesn't give the same result although they have the
same data.

The code for reading from CSV:

try {
Scanner scanner = new Scanner(new File("Businesses with names and within
the area.csv"));
 while(scanner.hasNextLine()){

       String x = scanner.nextLine();                  // Extract that line
       String[] values = x.split(",");         // Split that line at the
commas
       SME agent=new SME();
       context.add(agent);
       Coordinate coord = new
Coordinate((Double.parseDouble(values[2])),(Double.parseDouble(values[1])));
       Point geom = fac.createPoint(coord);
geography.move(agent, geom);
   }
} catch (FileNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}

By the way when I read the same shapefile using the following code, it also
gives extra companies in the middle of the street. It only work correctly
when I add the shapefile from the display wizard.

File shapefile=null;
ShapefileLoader<SME> SMELoader=null;
try{
shapefile=new File("CSV_point.shp");
SMELoader=new ShapefileLoader<SME>(SME.class, shapefile.toURL(), geography,
context);
}
catch(java.net.MalformedURLException e){
e.printStackTrace();
}
while(SMELoader.hasNext()){
SMELoader.next();


Could you please tell me what;s wrong?

Thanks in advance,
-------------- next part --------------
An HTML attachment was scrubbed...

------------------------------

Message: 3
Date: Fri, 9 Sep 2016 01:49:55 -0700 (MST)
From: jlefur <[hidden email]>
Subject: [Repast-interest] cannot halt simulation
To: [hidden email]
Message-ID: <[hidden email]>
Content-Type: text/plain; charset=us-ascii

Hello,
We cannot manage to halt our simulation and we have no idea of where this
problem comes from. The following two points were not occurring in former
versions of our model and of Simphony :

1) In the source code, the main step procedure is tagged annotated with
/@ScheduledMethod(start = 0, interval = 1, shuffle = false)/. Within this
procedure we test if simulation must halt and, if yes, trigger
/RepastEssentials.EndSimulationRun();/. However, the simulation continue
stepping.

2) in the graphical user interface the '/pause at/' and '/stop at/' function
in the /run options/ panel do not work any more.

We wonder whether these two behaviours come from the same problem.
We would greatly appreciate if you have any clue about where to search for a
solution ?
Regards,
Jean




--
View this message in context: http://repast.10935.n7.nabble.com/cannot-halt-simulation-tp11676.html
Sent from the repast-interest mailing list archive at Nabble.com.



------------------------------

------------------------------------------------------------------------------


------------------------------

_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest


End of Repast-interest Digest, Vol 124, Issue 5
***********************************************

------------------------------------------------------------------------------

_______________________________________________
Repast-interest mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/repast-interest
Loading...