<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">Hi John,<br>
      <br>
      if you load GH from extracted files you setup the GraphHopper
      class the same way as you would when doing the import.<br>
      I.e. you will have to configure the GraphHopper class identical as
      you did for the import.<br>
      <br>
      Peter<br>
      <br>
      On 28.05.2015 21:25, John Zhao wrote:<br>
    </div>
    <blockquote
cite="mid:CA+EBg9R7qz-85Kgh7Jdz8FDTjeYqWpZ6XJvxk7DLsX316Meu9Q@mail.gmail.com"
      type="cite">
      <div dir="ltr">There might be a little misunderstanding here.
        <div>If I start up GH with extracted files, the below string
          will be feed into EncodingManger.</div>
        <div>And it will throw an exception due to xxxcar is not found.</div>
        <div><br>
        </div>
        <div>Now my solution is write the similar code as
          EncodingManger.</div>
        <div>My thinking is if we use reflection here, it will be very
          easy to extend any kind of flagEncoder.</div>
        <div><br>
        </div>
        <div>I can do it on my own project, but for
          MoutainBike-->mtb, it's still annoying. </div>
        <div><br>
        </div>
        <div>Nvm, thank you Peter.</div>
      </div>
      <div class="gmail_extra"><br clear="all">
        <div>
          <div class="gmail_signature"><b>Best Regards,</b>
            <div><b>ZhiQiang ZHAO</b></div>
          </div>
        </div>
        <br>
        <div class="gmail_quote">On Thu, May 28, 2015 at 12:16 PM, Peter
          <span dir="ltr"><<a moz-do-not-send="true"
              href="mailto:graphhopper@gmx.de" target="_blank">graphhopper@gmx.de</a>></span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0
            .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div bgcolor="#FFFFFF" text="#000000">
              <div>you can do so too:<br>
                new
                YourFlagEncoder("speedFactor=5.0|speedBits=5|turnCosts=true")<br>
                <br>
                or use the normal java way:<br>
                new YourFlagEncoder(5, 5, 1)<br>
                <br>
                Regards,<br>
                Peter
                <div>
                  <div class="h5"><br>
                    <br>
                    On 28.05.2015 21:11, John Zhao wrote:<br>
                  </div>
                </div>
              </div>
              <div>
                <div class="h5">
                  <blockquote type="cite">
                    <div dir="ltr">Thanks Peter for your answer.
                      <div><br>
                      </div>
                      <div>I mean "combne" is if I have something inside
                        properties like:</div>
                      <div>graph.flagEncoders=xxxcar|speedFactor=5.0|speedBits=5|turnCosts=true,

                        bike, mtb, foot<br>
                      </div>
                      <div><br>
                      </div>
                      <div>I want to it can be parsed by the program
                        without hard code.</div>
                    </div>
                    <div class="gmail_extra"><br clear="all">
                      <div>
                        <div><b>Best Regards,</b>
                          <div><b>ZhiQiang ZHAO</b></div>
                        </div>
                      </div>
                      <br>
                      <div class="gmail_quote">On Thu, May 28, 2015 at
                        12:01 PM, Peter <span dir="ltr"><<a
                            moz-do-not-send="true"
                            href="mailto:graphhopper@gmx.de"
                            target="_blank">graphhopper@gmx.de</a>></span>
                        wrote:<br>
                        <blockquote class="gmail_quote" style="margin:0
                          0 0 .8ex;border-left:1px #ccc
                          solid;padding-left:1ex">
                          <div bgcolor="#FFFFFF" text="#000000">
                            <div>Hi,<br>
                              <br>
                              I'm not sure what you mean with 'combine'.
                              You can mix Java API and read from config
                              too e.g. via<br>
                              <br>
graphHopper.init(CmdArgs.readFromConfig(..))<br>
                              graphHopper.setEncodingManager(new
                              YourFlagEncoder(), new CarFlagEncoder(),
                              ...)<span><br>
                                <br>
                                > Could you elaborate a little bit
                                more about the portability reason? I am
                                new to reflection.<br>
                                <br>
                              </span> It is just that we want to support
                              JavaScript (TeaVM) and iOS, and for them
                              we need to avoid some stuff.<br>
                              <br>
                              Kind Regards,<br>
                              Peter<span><br>
                                <br>
                                On 28.05.2015 20:49, John Zhao wrote:<br>
                              </span></div>
                            <span>
                              <blockquote type="cite">
                                <div dir="ltr">Hi Peter,
                                  <div><br>
                                  </div>
                                  <div>I want to keep the compatibility
                                    of combine the existing flagEncoder
                                    with my customized flagEncoder.</div>
                                  <div>And intialize them from the
                                    properties file.</div>
                                  <div><br>
                                  </div>
                                  <div>Could you elaborate a little bit
                                    more about the portability reason?</div>
                                  <div>I am new to reflection.</div>
                                </div>
                                <div class="gmail_extra"><br clear="all">
                                  <div>
                                    <div><b>Best Regards,</b>
                                      <div><b>ZhiQiang ZHAO</b></div>
                                    </div>
                                  </div>
                                  <br>
                                  <div class="gmail_quote">On Thu, May
                                    28, 2015 at 11:44 AM, Peter <span
                                      dir="ltr"><<a
                                        moz-do-not-send="true"
                                        href="mailto:graphhopper@gmx.de"
                                        target="_blank">graphhopper@gmx.de</a>></span>
                                    wrote:<br>
                                    <blockquote class="gmail_quote"
                                      style="margin:0 0 0
                                      .8ex;border-left:1px #ccc
                                      solid;padding-left:1ex">
                                      <div bgcolor="#FFFFFF"
                                        text="#000000">
                                        <div>Hi John,<br>
                                          <br>
                                          if you have a custom
                                          flagencoder why not just call<br>
                                          new EncodingManager(new
                                          YourFlagEncoder()) ?<br>
                                          <br>
                                          Reflections was abandoned due
                                          to portability reasons but
                                          also it is not really
                                          necessary here, especially as
                                          you use it as a library and
                                          you have a custom flag encoder
                                          anyway.<br>
                                          <br>
                                          Regards,<br>
                                          Peter
                                          <div>
                                            <div><br>
                                              <br>
                                              On 28.05.2015 20:14, John
                                              Zhao wrote:<br>
                                            </div>
                                          </div>
                                        </div>
                                        <blockquote type="cite">
                                          <div>
                                            <div>
                                              <div dir="ltr">Hi,
                                                <div><br>
                                                </div>
                                                <div>I have a project
                                                  which use GH as a
                                                  library.</div>
                                                <div>I have implemented
                                                  my own flag encoder,
                                                  like xxxFlagEncoder.</div>
                                                <div>I don't figure out
                                                  a good way to
                                                  initialize it, except
                                                  to change the
                                                  EncodingManger to
                                                  insert xxxFlagEncoder
                                                  on
                                                  parseEncoderString().</div>
                                                <div>I think it's better
                                                  the change the way
                                                  EncodingManger
                                                  initialize all the
                                                  flagEncoders.</div>
                                                <div>EncodingManger can
                                                  use reflection to find
                                                  the class or
                                                  flagEncoder from its
                                                  name, if we
                                                  standardize the name
                                                  and toString method.</div>
                                                <div><br>
                                                </div>
                                                <div>Do you think it's a
                                                  good idea, or there is
                                                  a better way? </div>
                                                <br>
                                              </div>
                                            </div>
                                          </div>
                                        </blockquote>
                                      </div>
                                    </blockquote>
                                  </div>
                                </div>
                              </blockquote>
                              <br>
                            </span></div>
                          <br>
                        </blockquote>
                      </div>
                    </div>
                  </blockquote>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>