コード例 #1
0
bool ossimImageElevationDatabase::loadState(const ossimKeywordlist& kwl, const char* prefix)
{
   static const char M[] = "ossimImageElevationDatabase::loadState";
   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << M << " entered..." << "\nkwl:\n" << kwl << "\n";
   }     
   bool result = false;
   const char* lookup = kwl.find(prefix, "type");
   if ( lookup )
   {
      std::string type = lookup;
      if ( ( type == "image_directory" ) || ( type == "ossimImageElevationDatabase" ) )
      {
         result = ossimElevationDatabase::loadState(kwl, prefix);

         if ( result )
         {
            loadFileMap();
         }
      }
   }

   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG) << M << " result=" << (result?"true\n":"false\n");
   }

   return result;
}
コード例 #2
0
bool ossimImageElevationDatabase::open(const ossimString& connectionString)
{
   // return false; // tmp drb...
   
   static const char M[] = "ossimImageElevationDatabase::open";
   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG)
         << M << " entered...\n"
         << "\nConnection string: " << connectionString << "\n";
   }                   
   
   bool result = false;

   close();

   if ( connectionString.size() )
   {
      m_connectionString = connectionString.c_str();

      loadFileMap();

      if ( m_entryMap.size() )
      {
         result = true;
      }
      else
      {
         m_connectionString.clear();
      }
   }
   
   if(traceDebug())
   {
      ossimNotify(ossimNotifyLevel_DEBUG) << M << " result=" << (result?"true\n":"false\n");
   }

   return result;
}
コード例 #3
0
ファイル: drawmap.cpp プロジェクト: xbackupx/showeqx
int main (int argc, char *argv[])
{
  // CGI Convenience class
  CGI cgiconv;

  // state variables
  // assume the user didn't pass any map name
  bool drawMap = false;

  // name of the map to display if any
  QString mapName;

  // process any CGI data
  cgiconv.processCGIData();

  /* Check if we were passed a map to read */	
  if (argc == 2)
  {
    drawMap = true;
    mapName = argv[1];
  }
  else if (cgiconv.getParamCount() != 0)
  {
    mapName = cgiconv.getParamValue("map");
    drawMap = (cgiconv.getParamValue("draw") == "y");
  }

  // if in drawmap mode, then that's all that's done
  if (drawMap)
  {	
    QRegExp slashExp("/");
    mapName.replace(slashExp, "_");

    mapName.prepend(MAPDIR "/");
    loadFileMap ((const char*)mapName);
    paintMap();
  }
  else
  {
    // open the output data stream
    QTextStream out(stdout, IO_WriteOnly);
    out.setEncoding(QTextStream::Latin1);
    out.flags(QTextStream::showbase | QTextStream::dec);
    
    const char* header =
      "Content-type: text/html; charset=iso-8859-1\n\n"
      "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\">\n"
      "<HTML>\n"
      "  <HEAD>\n"
      "    <TITLE>ShowEQ Map Display</TITLE>\n"
      "    <style type=\"text/css\">\n"
      "      <!--\n"
      "          table { border: black 2px solid }\n"
      "          td { border: black 1px solid }\n"
      "          th { border: black 1px solid }\n"
      "      -->\n"
      "    </style>\n" 
      "  </HEAD>\n"
      "  <BODY>\n";

    /* Print HTML header */
    out << header;

    const char* footer = 
      "  </BODY>\n"
      "</HTML>\n";

    // otherwise display an HTML form to allow the user to choose a map
    QDir  mapDir(MAPDIR, "*.map", (QDir::Name | QDir::IgnoreCase), 
		 (QDir::Files | QDir::Readable));

    if (!mapDir.exists())
    {
      out << "<H1>The map directory '" MAPDIR "' doesn't exist!</H1>\n";
      out << footer;
      return 0;
    }

    QString userAgent = cgiconv.getHTTPUserAgent();

    out << "<FORM method=\"POST\" action=\"" << cgiconv.getScriptName() 
	<< "\">\n";

    // beware Netscape 4.x style sheet brain death
    if ((userAgent.contains("Mozilla/4.") == 1) && 
	(userAgent.contains("MSIE") == 0))
      out << "<TABLE border=2 cellspacing=0 cellpadding=2>\n";
    else
      out << "<TABLE cellspacing=0 cellpadding=2>\n";
    
    out << "<TR>";
    out << "  <TH>Map Name</TH>";
    out << "  <TD><INPUT type=\"reset\" value=\"Reset\"/></TD>\n";
    out << "</TR>";
    out << "<TR>";
    out << "<TD><SELECT name=\"map\" size=\"1\">\n";

    // create a file info list
    const QFileInfoList *list = mapDir.entryInfoList();

    // create an iterator over the list
    QFileInfoListIterator it( *list );
    
    // pointer to the file info for the current file
    QFileInfo *fi;

    while ( (fi=it.current()) ) 
    {
      out << "<OPTION value=\"" << fi->fileName() << "\"";
      if (mapName == fi->fileName())
	out << " selected";
      out << ">" << fi->baseName() << "</OPTION>\n";
      
      // goto next element from list
      ++it;
    }

    out << "</SELECT></TD>\n";
  
    // Submission button
    out << "<TD><INPUT type=\"submit\" value=\"Display\"/></TD>\n";

    out << 
      "</TR>"
      "</TABLE>"
      "</FORM>";


    if (!mapName.isEmpty())
    {
      out << "<H1>Map: " << mapName << "</H1>\n";
      out << "<DIV><IMG src=\"" << cgiconv.getScriptName()
	  << "?map=" << mapName << ";draw=y\" alt=\"Map: "
	  << mapName << "\"/></DIV>\n";
    }

    out << footer;
  }

  return 0;
}