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 7587999
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:48:53+00:00 2026-05-30T19:48:53+00:00

I have been trying to debug this with no luck. I have a fall

  • 0

I have been trying to debug this with no luck. I have a fall through switch case that seems to work as I watch the stack and it hits all breaks points I set (pretend that the type is polygon and I put a break put on all that should come up). I hit every one of those but it fails. So.. here is the first one that does work.

function create_map_element3(type,op,map){
    var _op={};
    defined(map)                ?_op.map=map:null;
    defined(op.clickable)       ?_op.clickable=op.clickable:null;
    defined(op.visible)         ?_op.visible=op.visible:null;
    defined(op.zIndex)          ?_op.zIndex=op.zIndex:null;

    switch(type){
        case "polygon" :
            defined(op.editable)        ?_op.editable=op.editable:null;
            defined(op.fillOpacity)     ?_op.fillOpacity=op.fillOpacity:null;
            return new google.maps.Polygon(_op);
            break;
        case "rectangle" :
            defined(op.editable)        ?_op.editable=op.editable:null;
            defined(op.fillOpacity)     ?_op.fillOpacity=op.fillOpacity:null;
            return new google.maps.Rectangle(_op);
            break;
        case "circle" :
            defined(op.editable)        ?_op.editable=op.editable:null;
            defined(op.fillOpacity)     ?_op.fillOpacity=op.fillOpacity:null;
            return new google.maps.Circle(_op);
            break;          
        case "polyline" :
            defined(op.editable)        ?_op.editable=op.editable:null;
            defined(op.strokeWeight)    ?_op.strokeWeight=op.strokeWeight:null;
            return new google.maps.Polyline(_op);
            break;              
        case "marker" :
            defined(op.animation)       ?_op.animation=op.animation:null;
            return new google.maps.Marker(_op);
            break;
    };
}

that works.. I get the google map element out just fine. Now with the change, and again when I debug I hit all break points _op object is filled and have it’s properties filled… but nothing…

function create_map_element(type,op,map){
    var _op={};
    defined(map)                ?_op.map=map:null;
    switch(type){
        case "polygon": case "polyline" :  case "rectangle" : case "circle" : case "marker" :
                defined(op.clickable)       ?_op.clickable=op.clickable:null;
                defined(op.visible)         ?_op.visible=op.visible:null;
                defined(op.zIndex)          ?_op.zIndex=op.zIndex:null;
        case "polygon": case "polyline" :  case "rectangle" : case "circle" :
                defined(op.strokeColor)     ?_op.strokeColor=op.strokeColor:null;
                defined(op.strokeOpacity)   ?_op.strokeOpacity=op.strokeOpacity:null;
                defined(op.strokeWeight)    ?_op.strokeWeight=op.strokeWeight:null;
        case "polygon": case "rectangle" : case "circle" :
                defined(op.fillOpacity)     ?_op.fillOpacity=op.fillOpacity:null;
        case "polygon": case "polyline" :
                defined(op.geodesic)        ?_op.geodesic=op.geodesic:null;             
        case "marker" :
                defined(op.animation)       ?_op.animation=op.animation:null;
        case "polygon" :
                return new google.maps.Polygon(_op);
            break;
        case "rectangle" :
                return new google.maps.Rectangle(_op);
            break;
        case "circle" :
                return new google.maps.Circle(_op);
            break;          
        case "polyline" :
                return new google.maps.Polyline(_op);
            break;              
        case "marker" :
                return new google.maps.Marker(_op);
            break;  
    };
}

But when I set the break points on the retrun line it hits it and all looks right.. but.. nothing.. Anyone have an idea? Thank you – Jeremy

[EDIT]
Based on , um I don’t know who deleted their anwser but it was on the right track of the cause of the case swtich failing… here is an option I was trying to do with the same idea as above.

function create_map_element(type,op,map){
    var _op={};
    defined(map)?_op.map=map:null;
    defined(op.clickable)       ?_op.clickable=op.clickable:null;
    defined(op.visible)         ?_op.visible=op.visible:null;
    defined(op.zIndex)          ?_op.zIndex=op.zIndex:null;

    if( ["polygon","polyline","rectangle","circle"].indexOf(type)!== -1  ){
                    defined(op.strokeColor)     ?_op.strokeColor=op.strokeColor:null;
                    defined(op.strokeOpacity)   ?_op.strokeOpacity=op.strokeOpacity:null;
                    defined(op.strokeWeight)    ?_op.strokeWeight=op.strokeWeight:null;
    }
    if( ["polygon","rectangle","circle"].indexOf(type)!== -1  ){
                    defined(op.fillColor)       ?_op.fillColor=op.fillColor:null;
                    defined(op.fillOpacity)     ?_op.fillOpacity=op.fillOpacity:null;
    }
    if( ["polygon","polyline"].indexOf(type)!== -1  ){
                    defined(op.geodesic)        ?_op.geodesic=op.geodesic:null;         
    }
    if(type == "marker"){
                    defined(op.animation)       ?_op.animation=op.animation:null;
                    defined(op.cursor)          ?_op.cursor=op.cursor:null;
                    defined(op.draggable)       ?_op.draggable=op.draggable:null;
                    defined(op.flat)            ?_op.flat=op.flat:null;
                    defined(op.icon)            ?_op.icon=op.icon:null;
                    defined(op.optimized)       ?_op.optimized=op.optimized:null;
                    defined(op.position)        ?_op.position=op.position:null;                 
                    defined(op.raiseOnDrag)     ?_op.raiseOnDrag=op.raiseOnDrag:null;                   
                    defined(op.shadow)          ?_op.shadow=op.shadow:null; 
                    defined(op.shape)           ?_op.shape=op.shape:null;                       
                    defined(op.title)           ?_op.title=op.title:null;   
    }
    switch(type){
        case "polygon" :
                return new google.maps.Polygon(_op);
            break;
        case "rectangle" :
                return new google.maps.Rectangle(_op);
            break;
        case "circle" :
                return new google.maps.Circle(_op);
            break;          
        case "polyline" :
                return new google.maps.Polyline(_op);
            break;              
        case "marker" :
                return new google.maps.Marker(_op);
            break;  
    };
}

Now odly this doesn’t work too BUT .. it hits all break points correctly and when I inspect it, it seems well. It just doesn’t return the google map element.. again the top code block (function create_map_element3) does work..

  • 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-05-30T19:48:54+00:00Added an answer on May 30, 2026 at 7:48 pm

    Don’t know why the down votes, but it does seem that the answer is, No, you can’t fix it as the case will iterate thru everything at it asserts that it’s case is true from the group it was in.

    IE:

    case "polygon": case "polyline" :  case "rectangle" : case "circle" : case "marker" :   
    

    MADE the later

    case "marker" : 
    

    TRUE even if the type is “polygon”

    Simply running break points in the function under each case shows that you hit inside even when the case was already hit. If you remove one of the fall thru cases IE: take case “marker” : out then as expected it passes by as again the type is “polygon” so the case was false.

    Odd but it is what it is. Better explanations welcomed and this was based on the occurence pointed out by Dr. Molle.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been trying to work my way through Project Euler, and have noticed
I have been trying to make a case for using Python at my work.
I have been trying to debug the below python cgi code but doesn't seems
Hey, have been trying to work this out for last day or so but
I've been trying to debug this issue for weeks now and I have made
I have been trying to work with app.config sections by this example: http://msdn.microsoft.com/en-us/library/system.configuration.configurationcollectionattribute.aspx#Y2391 and
I have a serious problem that i have been trying to debug for a
I have been trying to determine a best case solution for registering a COM
I have been trying to get around this error for a day now and
I have been trying to explain the difference between switch statements and pattern matching(F#)

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.