Other Software and Data

 View Only
  • 1.  Problem using StyleFactory.FromMBString method

    Posted 01-16-2020 08:33
    Hi,!

    Please, can tell me why the FromMBString method give me an error?

    We are using MapxTreme 8.1 for Desktop applications with VB.Net 2015

    Dim lo_StyleFactory As New MapInfo.Styles.StyleFactory
    Dim lo_CompositeStyle As New MapInfo.Styles.CompositeStyle()

    lo_CompositeStyle = lo_StyleFactory.FromMBString("MakeSymbol (44, RED, 16)")
    or
    lo_CompositeStyle = lo_StyleFactory.FromMBString("MakeFontSymbol (35,16711680,5,MapInfo Symbols,0,0)")

    in both case the program fails.

    I can't find any excample on Web and documentatipon

    Thank you!

    ------------------------------
    Alejandro Hernandez
    Information Technology & Services
    ITS SA (GBD)
    Buenos Aires
    ------------------------------


  • 2.  RE: Problem using StyleFactory.FromMBString method

    Posted 01-19-2020 13:53
    Hi, 

    Please, someone can help me with this issue?

    Thank you!

    ------------------------------
    Alejandro Hernandez
    Information Technology & Services
    ITS SA (GBD)
    Buenos Aires
    ------------------------------



  • 3.  RE: Problem using StyleFactory.FromMBString method

    Employee
    Posted 01-20-2020 03:05
    Hi Alejandro,

    I don't think you can include MapBasic constants inside a string when parsing the symbol style.

    Try this:
    lo_CompositeStyle = lo_StyleFactory.FromMBString("MakeSymbol (44, 16711680, 16)")

    I have replaced RED with the color code for RED.

    For the second example, you need quotes around the font name:
    lo_CompositeStyle = lo_StyleFactory.FromMBString("MakeFontSymbol (35,16711680,5,""MapInfo Symbols"",0,0)")

    Let me know how this works for you

    ------------------------------
    Peter Horsbøll Møller
    Distinguished Engineer
    Pitney Bowes Software & Data
    ------------------------------



  • 4.  RE: Problem using StyleFactory.FromMBString method

    Posted 01-20-2020 05:53
    Hi Peter,

    No, I had allready tested these alternatives

    I tried again and I get this messaghe error: "Unable to create style from specified MapBasic clause"

    Also I tried 
    lo_CompositeStyle = lo_StyleFactory.FromMBString("(35,16711680,5,""MapInfo Symbols"",0,0)")
    and
    lo_CompositeStyle = lo_StyleFactory.FromMBString("35,16711680,5,""MapInfo Symbols"",0,0")
    and
    lo_CompositeStyle = lo_StyleFactory.FromMBString("44, 16711680, 16")
    and
    lo_CompositeStyle = lo_StyleFactory.FromMBString("(44, 16711680, 16)")

    but I get the same message error
     
    In MapXtreme documentation is no possible to find any example

    Thank you

    ------------------------------
    Alejandro Hernandez
    Information Technology & Services
    ITS SA (GBD)
    Buenos Aires
    ------------------------------



  • 5.  RE: Problem using StyleFactory.FromMBString method

    Employee
    Posted 01-20-2020 06:12
    Edited by Peter Møller 01-20-2020 06:13
    Hi

    The MapXtreme Help System states:
    Takes a MapBasic style clause as string input and returns it as a CompositeStyle.

    Examples of valid MapBasic style clauses are: "Pen ( 1, 2, 0)" "Pen ( 1, 2, 0 ) Brush ( 2,14745520,0 )" "Symbol (38,16711680,4,"MapInfo Cartographic",256,0) Pen ( 40, 192, 255) etc... "

    There can be no embedded RGB functions to indicate colors. To correctly create an AreaStyle the Pen clause must preceed the Brush clause.

    You seem to be missing the preceding Pen or Symbol:
    lo_CompositeStyle = lo_StyleFactory.FromMBString("Symbol(35,16711680,5,""MapInfo Symbols"",0,0)")

    Also, you shouldn't use MakeSymbol or the more specific MakeFontSymbol. Sorry I didn't catch that in my first reply


    ------------------------------
    Peter Horsbøll Møller
    Distinguished Engineer
    Pitney Bowes Software & Data
    ------------------------------



  • 6.  RE: Problem using StyleFactory.FromMBString method

    Posted 01-20-2020 08:53
    Excelent !!

    Thank you Peter !

    ------------------------------
    Alejandro Hernandez
    Information Technology & Services
    ITS SA (GBD)
    Buenos Aires
    ------------------------------