#include <tmsproviderfactory.h>
#include <ostnormalprovider.h>
#include <gaodenormalprovider.h>
#pragma execution_character_set("utf-8")

namespace LAMPMainWidget {

QHash<TmsProviders, LayerProvider *> TmsProviderFactory::mProviders{};

LayerProvider *
TmsProviderFactory::create(LAMPMainWidget::TmsProviders provider) {
  LayerProvider *result = nullptr;
  switch (provider) {
    case OSTNormalMap:
      if (mProviders.contains(OSTNormalMap)) {
        result = mProviders.value(OSTNormalMap);
      } else {
        result = new OSTNormalProvider();
        mProviders.insert(OSTNormalMap, result);
      }
      break;
    case GaodeNormapMap:
      if (mProviders.contains(GaodeNormapMap)) {
        result = mProviders.value(GaodeNormapMap);
      } else {
        result = new GaodeNormalProvider();
        mProviders.insert(GaodeNormapMap, result);
      }
      break;
    default:break;
  }

  return result;
}

}

