osm_flutter icon indicating copy to clipboard operation
osm_flutter copied to clipboard

add possibility to create multiple road

Open liodali opened this issue 3 years ago • 5 comments

For now OSMFlutter doesn't support draw multiple roads. I will try to add support of creation multiple road by adding :

  • [x] create method to draw multiple roads in the same time
  • [ ] add attribute in draw road called idRoad has String type, the same for the method drawManuallyRoad if the idRoad is null , it will be set automatically inside the libray and returned with roadInformation
  • [ ] add attribute in draw road called removeIdRoad has String type, the same for the method drawManuallyRoad if that attribute was null or doesn't exist we will not remove the road
  • [ ] create new method clearAllRoads
  • [ ] create new method removeRoadById , if the id doesn't exist nothing will happen

liodali avatar Feb 04 '22 12:02 liodali

@suvindran3 i finished implementation of drawMultiRoad i will publish new release and adding some docs but this feature for now will available in android and i will add it to iOS in couple of days, this release will help you to continue working on your project in future releases i will make small changes such as adding id for each road and improve more the implementation

liodali avatar Feb 06 '22 09:02 liodali

I didn't expect you'd finish it within a couple of days. I'm looking forward to the release.

suvindran3 avatar Feb 06 '22 10:02 suvindran3

I created new method drawMultipleRoad that accept 2 parameter : 1- List of MultiRoadConfiguration, for each MultiRoadConfiguration, you should define startPoint and destinationPoint, intersectPoints and roadOptionConfiguration are optional a 2- object type of MultiRoadOption that allow to configure the roads that have the same RoadOption such as color, width and RoadType

here small example :

final configs = [
      MultiRoadConfiguration(
        startPoint: GeoPoint(
          latitude: 47.4834379430,
          longitude: 8.4638911095,
        ),
        destinationPoint: GeoPoint(
          latitude: 47.4046149269,
          longitude: 8.5046595453,
        ),
      ),
      MultiRoadConfiguration(
          startPoint: GeoPoint(
            latitude: 47.4814981476,
            longitude: 8.5244329867,
          ),
          destinationPoint: GeoPoint(
            latitude: 47.3982152237,
            longitude: 8.4129691189,
          ),
          roadOptionConfiguration: MultiRoadOption(
            roadColor: Colors.orange,
          )),
      MultiRoadConfiguration(
        startPoint: GeoPoint(
          latitude: 47.4519015578,
          longitude: 8.4371175094,
        ),
        destinationPoint: GeoPoint(
          latitude: 47.4321999727,
          longitude: 8.5147623089,
        ),
      ),
    ];
    await controller.drawMultipleRoad(
      configs,
      commonRoadOption: MultiRoadOption(
        roadColor: Colors.red,
      ),
    );


NB: I didn't change the behaviour of drawRoad for now but in future release I will remove deletion of previous road from it

liodali avatar Feb 06 '22 11:02 liodali

I published new version 0.30.0

liodali avatar Feb 06 '22 12:02 liodali

I added the support of drawing multiple roads in iOS in the new version 0.31.0 for next versions maybe after 0.40.+ i will change behaviour little bit , it will be more easy and i will provide more apis for that

liodali avatar Feb 19 '22 18:02 liodali