Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7708567
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T00:38:41+00:00 2026-06-01T00:38:41+00:00

I have a web app that will draw a polyline for each user (tracks

  • 0

I have a web app that will draw a polyline for each user (tracks movement), and I’d like to incorporate some functionality that allows the web app user to ‘focus’ on a certain user by changing the color of the polyline. It will have to first change all the polylines to red, and then change the selected polyline to blue. I think this is best to avoid focusing on one line, then trying to focus on another and having them both blue.

I’m really not sure how to implement this, but I have functionality that returns a user id when the name is pressed. I just need to iterate over each object (each user’s polyline) to change them to red first, then change the specific one to blue. Here is some code below. This is a condensed version of my code.

function User(id) {
this.id = id;

this.locations = [];

this.mark = 0;

this.getId = function() {
    return this.id;
};

this.addLocation = function(latitude, longitude) {
    this.locations[this.locations.length] = new google.maps.LatLng(latitude, longitude);        
};
var polyline;
this.drawPolyline = function(loc) {
        polyline = new google.maps.Polyline({
        map: map,
        path: loc,
        strokeColor: "#FF0000",
        strokeOpacity: 1.0,
        strokeWeight: 2
        });
    polyline.setMap(map);
};

this.removePolyline = function() {
    if (polyline != undefined) {
        polyline.setMap(null);
        }
    }
this.get_user_info = function(user_id) {

var datastr = 'id=' + user_id;
$.ajax({    
    type: "POST",
    url: 'user_api.php',  
    data: datastr,      
    dataType: 'json',                   
    success: function(data){
        var phone_id = data[0];
        var leftDiv = document.createElement("div"); //Create left div
        leftDiv.id = "left"; //Assign div id
        leftDiv.setAttribute("style", "float:left; width:66.5%; line-height: 26px; text-align:left; font-size:12pt; padding-left:8px; height:26px;"); //Set div attributes
        leftDiv.style.background =  divColor;
        //user_name = document.createTextNode(fullName + ' '); //Set user name          
        a = document.createElement('a');
        a.href ="javascript:setFocus('" + phone_id + "');";
        a.innerHTML = fullName + ' ';
        leftDiv.appendChild(a);
      }
    });
  }
}

function setFocus(phone_id) {
    alert(phone_id);
}
function Users() {
this.users = {};

this.createUser = function(id) {
    this.users[id] = new User(id);
    return this.users[id];
};

this.getUser = function(id) {
    return this.users[id];      
};

this.removeUser = function(id) {
    var user = this.getUser(id);
    delete this.users[id];
    return user;
};
}

var users = new Users();
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-01T00:38:43+00:00Added an answer on June 1, 2026 at 12:38 am

    Currently you are not storing the polyline inside the User-object, you should first do it to make the line accessible later:

    this.drawPolyline = function(loc) {
            this.polyline = new google.maps.Polyline({//<--note the this
            map: map,
            path: loc,
            strokeColor: "#FF0000",
            strokeOpacity: 1.0,
            strokeWeight: 2
            });
        this.polyline.setMap(map);
    };
    

    now you will be able to higlight a line:

    Users.prototype.highlightLine=function(id)
    {
      for(var k in this.users)
      {
        this.users[k].polyline.setOptions({strokeColor:(id===k)?'blue':'red'});
      }
    }
    
    //use it
    users.highlightLine(5)//will highlight the line for user with id 5
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We are developing a web app that will have a pretty complex user and
I'm to make a web app that will implement something like user hierarchy. I
We are developing the Web App that will have user subscription to a specific
Background I have a web app that will create an image from user input.
I have installed an HttpModule into my web app that will handle all requests
I'm about to have to write a web page/app that will serve the agenda
This is the scenario i have: im developing a web app that will list
I'm working on a web app that will allow the user to do a
I have a web-app that will reside on a production server where I want
I want to create a simple web app that will have a connection from

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.