eishub / tygron

Tygron-EIS Connector
0 stars 5 forks source link

Add Multipolygon to building percept #57

Closed tvleest closed 8 years ago

tvleest commented 8 years ago

To be able to upgrade a building we need the multipolygon describing the area of that building.

building(Id, Name, OwnerID, ConstructionYear, Categories, FunctionID, Floors, Multipolygon)

Unless someone has a better solution?

levilime commented 8 years ago

I agree this solves the problem for upgrading :+1:

MaxGroenenboom commented 8 years ago

Don't buildings have an ID as well? I suppose that could also be used instead of the polygon. [edit: apologies for the email formatting]

tvleest commented 8 years ago

Thats not how the action currently works in the SDK, it needs a multipolygon.

@EventParamData(desc = "Plan the upgrade of buildings in the given polygon in the MAQUETTE map", params = { "Stakeholder ID", "Upgrade Type ID", "Multipolygon describing the upgrade area" }) @EventIDField(links = { "STAKEHOLDERS", "UPGRADE_TYPES" }, params = { 0, 1 }) BUILDING_PLAN_UPGRADE(ClientTerms.ACTION_LOG_UPGRADE, Integer.class, Integer.class, MultiPolygon.class),

MaxGroenenboom commented 8 years ago

Ah, it is probably possible to upgrade only a part of a building then? That is pretty nice. It is also possible of course to create your own action that fetches the multipolygon for you, having only the buildingID as parameter.

spiderbiggen commented 8 years ago

@maxgroenenboom i don't think it is possible to get a result from an action. Correct me if I'm wrong though.

MaxGroenenboom commented 8 years ago

I'm not talking about getting a result from an action? What I mean is defining a new action, that then calls the original action.

levilime commented 8 years ago

@MaxGroenenboom I don't think such an action is possible, because actions are predefined in the environment. By design an agent does an action and then through perceiving the environment next cycle he can deduce what effect is action has. He can't get a response, as spiderbiggen already said.

spiderbiggen commented 8 years ago

It might be possible but i don't think that adding a new action is the easiest way to do this.

edit ... that was the wrong button

MaxGroenenboom commented 8 years ago

I think it is pretty easy to do this. I am now building a list of actions the PerformAction function in TygronEntity.java will look through before trying the server actions, thus making it possible to create your own actions, or even override server actions.

tvleest commented 8 years ago

Sounds like that might be a better solution.

MaxGroenenboom commented 8 years ago

So, this isn't as easy as it should be, as the PerformAction method isn't called at all when a non-sdk action is called. Even when I add my custom action to the sdk (temporarily, just for testing), it still doesn't work...

spiderbiggen commented 8 years ago

Can you push your code to a branch so i can take a look?

MaxGroenenboom commented 8 years ago

Sure, you can find the branch here: https://github.com/Denpeer/tygron/tree/getRelevantAreas Brace yourself, some of it will be very ugly code, it wasn't my intention to publish this :P

MaxGroenenboom commented 8 years ago

Rico has found the cause of the errors, Line 87 in EisEnv.java, I am going to see if I can get it to work now.

tvleest commented 8 years ago

We've added multiPolygon to our own fork, so we can at least demo something friday. If other groups are interested we could make a PR out of it. It does use powermockito though. #51 Here is a travis build log https://travis-ci.org/spiderbiggen/tygron/builds/134122390

tvleest commented 8 years ago

68 fixed this