 
     override func viewDidLoad() {
         super.viewDidLoad()
-    }
-    
-    override func viewDidAppear(_ animated: Bool) {
-        super.viewDidAppear(animated)
-    
         
         
         // Set up the cluster manager with the supplied icon generator and

    
    
    
    var isCollectionViewShow: Bool = false {
        didSet {
            if self.collectionViewBottomConstraint != nil {
                self.view.bringSubview(toFront: self.collectionView)
                if isCollectionViewShow {
                    self.collectionViewBottomConstraint.constant = 0
                } else {
                    self.collectionViewBottomConstraint.constant = 120
                }
                UIView.animate(withDuration: 0.2, animations: { 
                    self.view.layoutIfNeeded()
                })
            }
        }
    }
    
    var collectionViewBottomConstraint: NSLayoutConstraint!
    
    var displayDataModel: [KPDataModel]! {
        didSet {
            (self.view as! GMSMapView).clear()
            for datamodel in self.displayDataModel  {
                self.clusterManager.add(datamodel)
            }
            

    
    func mapView(_ mapView: GMSMapView, markerInfoWindow marker: GMSMarker) -> UIView? {
        
        // 過濾cluster的marker
        if (marker.userData as? KPDataModel) == nil {
            return nil
        }
        
//        if self.isCollectionViewShow == false  {
            self.isCollectionViewShow = true
//        }
        
        marker.icon = UIImage(named: "icon_mapMarkerSelected")
        let infoWindow = KPMainMapMarkerInfoWindow(dataModel: marker.userData as! KPDataModel)

        return infoWindow
    }
    
