<commit_before>package org.ossim.omar

import java.util.Date;
import org.ossim.omar.SuperOverlayQueueItem
import org.apache.commons.collections.map.CaseInsensitiveMap
import joms.oms.WmsView
import joms.oms.ossimUnitType
import joms.oms.Chain
import org.springframework.beans.factory.InitializingBean
import groovy.xml.StreamingMarkupBuilder
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
import javax.imageio.ImageIO

class SuperOverlayController implements InitializingBean{
	def baseDir
	def serverUrl
    def kmlService
    def superOverlayService
    def outputKmz = false
    def index = { render ""}
    def createKml = {
        def rasterEntry = null
        try
        {
            if(params.id)
            {
                rasterEntry = RasterEntry.findByIndexId(params.id)?:
                              RasterEntry.findByTitle(params.id)?:
                              RasterEntry.findById(params.id)
            }
        }
        catch(Exception e)
        {
            rasterEntry = null
        }

        if(rasterEntry)
        {
            // we will return the root document if any level of detail param is null
            //
            def isRoot = ( (params.level==null) || (params.row==null) || (params.col==null))

           // response.setHeader("Pragma", "no-cache");
           // response.setDateHeader("Expires", 1L);
           // response.setHeader("Cache-Control", "no-cache");
           // response.addHeader("Cache-Control", "no-store");

            if(!outputKmz)
            {
                if(!isRoot)
                {
                    def kmlString =  superOverlayService.createTileKml(rasterEntry, params)
                    //response.setDateHeader("Expires", System.currentTimeMillis()+(24*24*60*60*1000));
                   // response.addHeader("Cache-Control", "max-age=120")
                   //   response.setHeader("max-age", "120");<commit_msg>Added a quick check to turn off KMZ if more than one band is given in the bands= param<commit_after>package org.ossim.omar

import java.util.Date;
import org.ossim.omar.SuperOverlayQueueItem
import org.apache.commons.collections.map.CaseInsensitiveMap
import joms.oms.WmsView
import joms.oms.ossimUnitType
import joms.oms.Chain
import org.springframework.beans.factory.InitializingBean
import groovy.xml.StreamingMarkupBuilder
import java.util.zip.ZipEntry
import java.util.zip.ZipOutputStream
import javax.imageio.ImageIO
import org.apache.commons.collections.map.CaseInsensitiveMap

class SuperOverlayController implements InitializingBean{
	def baseDir
	def serverUrl
    def kmlService
    def superOverlayService
    def outputKmz = false
    def index = { render ""}
    def createKml = {
        def rasterEntry = null
        try
        {
            if(params.id)
            {
                rasterEntry = RasterEntry.findByIndexId(params.id)?:
                              RasterEntry.findByTitle(params.id)?:
                              RasterEntry.findById(params.id)
            }
        }
        catch(Exception e)
        {
            rasterEntry = null
        }

        if(rasterEntry)
        {
            def tempOutputKmz = outputKmz

            // There is currently a bug when a comma separated band list is given for kmz output
            // we will force to false if such a param is given.
            // For some reason if bands= is given and has more than one
            // band indicator it causes X to appear on the google earth window.
            // STill can't locate the reasoning so for now if KMZ is enabled and
            // we see a band= with more than 1 band indicator we will force to false and
            // output as a KML and add a href to the WMS chip service instead of embedding the chip
            // within the KMZ.
            //
            def caseInsensitiveParams = new CaseInsensitiveMap(params)
            if(tempOutputKmz&&caseInsensitiveParams.bands)
            {
                tempOutputKmz = caseInsensitiveParams.bands.split(",").length < 2
            }
            // we will return the root document if any level of detail param is null
            //
            def isRoot = ( (params.level==null) && (params.row==null) && (params.col==null))
            if(!outputKmz)
            {
                if(!isRoot)
                {
                    def kmlString =  superOverlayService.createTileKml(rasterEntry, params)
                    //response.setDateHeader("Expires", System.currentTimeMillis()+(24*24*60*60*1000));
                   // response.addHeader("Cache-Control", "max-age=120")
                   //   response.setHeader("max-age", "120");
{'fraction_non_alphanumeric': 0.08972441785943175, 'fraction_numerical': 0.008331553086947234, 'mean_word_length': 1.9708121827411167, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1570864', 'n_tokens_mistral': 1310, 'n_tokens_neox': 1267, 'n_words': 317}