How to build traccar from netbeans using source code?

karthikeyan8 years ago

Hi anton, i am setup to build the project for adding additional few functions. My questions is
1.Before start the project what are necessary files for start?
2.I downloaded the traccar server source code is it ok or need to download traccar-web source code also?
3.I want to add static marker in map.One of the forum question you said "You can start with MapController class." but i could not find that class file in traccar-server source code (i just add question link)
https://github.com/tananaev/traccar-web/issues/409#issuecomment-281167656
4.Can you give me the step by step instructions?

Thanks in advance

Anton Tananaev8 years ago
  1. All necessary files are in the repository.
  2. Yes. I would recommend to use git. Web part can be downloaded as a submodule.
  3. See point 2.
  4. Step by step instructions for what?
karthikeyan8 years ago

Thanks for fast reply, step by step instructions for adding additional functions like add static marker,separate colors for route.

Which file i could start?
I could not find the MapController class in traccar server source code.

where that file is located?

Thanks a lot

Anton Tananaev8 years ago

There can't be a step by step guide for adding new features.

Here is the class:

https://github.com/tananaev/traccar-web/blob/master/web/app/view/MapController.js

Not sure why you couldn't find it. Simple text search would find it without any problems.

karthikeyan8 years ago

Hi Anton thanks again for reply. I have added the following code in mapcontroller.js for adding a static marker. when i run the code it's not showing an errors and also i am not getting a static marker.

  1. Can you tell in this code any error?
  2. My approach is correct?
     var iconStyle = new ol.style.Style({
         image: new ol.style.Icon(({
             anchor: [15, 24],
             size: [32, 48],
             anchorXUnits: 'pixels',
             anchorYUnits: 'pixels',
             opacity: 0.75,
             src: 'http://openlayers.org/en/v3.9.0/examples/data/icon.png'
         }))
     });
    
    
     //Create a Feature
      var iconFeature = new ol.Feature({
             geometry: new ol.geom.Point([Traccar.Style.mapDefaultLon,Traccar.Style.mapDefaultLat])
    
         });
    
     //Setup a Vector Source
     var vectorSource = new ol.source.Vector({
         features: [iconFeature]
     });
    
     //Setup a Vector Layer
     var vectorLayer = new ol.layer.Vector({
         source: vectorSource
     });
    
     iconFeature.setStyle(iconStyle);
     
     var feature = new ol.Feature(new ol.geom.Point(Traccar.Style.mapDefaultLon,Traccar.Style.mapDefaultLat));
             feature.setStyle(iconStyle);
             vectorSource.clear();
             vectorSource.addFeature(feature);
             selectedlong = Traccar.Style.mapDefaultLon;
             selectedlat = Traccar.Style.mapDefaultLat;


thanks

Anton Tananaev8 years ago

If you need help with your customization, check this page:

https://www.traccar.org/product/custom-work/